godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.33k stars 21.24k forks source link

D3D12 TextureArray2D mipmaps missing/broken #98527

Open TokisanGames opened 4 weeks ago

TokisanGames commented 4 weeks ago

Tested versions

Reproducible in 4.3, 4.4dev3

System information

Windows 11/64, RTX 3070, D3D12

Issue description

In the Direct3D12 renderer, TextureArray2Ds don't seem to generate mipmaps so breaks Terrain3D and all other projects using them.

image

This code shows the next two images:

void fragment() {
    NORMAL = mat3(VIEW_MATRIX) * normalize(v_normal);
    // broken
    ALBEDO = texture(_texture_array_albedo, vec3(UV, 0.)).rgb;
    // works
    //ALBEDO = texture(test_albedo, UV).rgb;
}

image image

Forcing mip 0 with vec2(0) derivatives also works.

Downstream issue https://github.com/TokisanGames/Terrain3D/issues/529

Minimal reproduction project (MRP)

If you wish to edit the shader, enable Terrain3D / Material / Shader Override.

ArseniyMirniy commented 4 weeks ago

This is definitely the case where the project would be very helpful to reproduce it

TokisanGames commented 4 weeks ago

@ArseniyMirniy I added instructions that will take 2 minutes to create a test environment.