Apply uv transform in the prepass (#13250)

# Objective

- The UV transform was applied in the main pass but not the prepass.

## Solution

- Apply the UV transform in the prepass.

## Testing

- The normals in my scene now look correct when using the prepass.
This commit is contained in:
Griffin 2024-05-13 15:33:09 -07:00 committed by GitHub
parent 0eb4bb6bab
commit 519ed5de42
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -54,18 +54,18 @@ fn fragment(
#ifdef STANDARD_MATERIAL_NORMAL_MAP #ifdef STANDARD_MATERIAL_NORMAL_MAP
#ifdef STANDARD_MATERIAL_NORMAL_MAP_UV_B #ifdef STANDARD_MATERIAL_NORMAL_MAP_UV_B
let uv = in.uv_b; let uv = (material.uv_transform * vec3(in.uv_b, 1.0)).xy;
#else #else
let uv = in.uv; let uv = (material.uv_transform * vec3(in.uv, 1.0)).xy;
#endif #endif
// Fill in the sample bias so we can sample from textures. // Fill in the sample bias so we can sample from textures.
var bias: SampleBias; var bias: SampleBias;
#ifdef MESHLET_MESH_MATERIAL_PASS #ifdef MESHLET_MESH_MATERIAL_PASS
bias.ddx_uv = in.ddx_uv; bias.ddx_uv = in.ddx_uv;
bias.ddy_uv = in.ddy_uv; bias.ddy_uv = in.ddy_uv;
#else // MESHLET_MESH_MATERIAL_PASS #else // MESHLET_MESH_MATERIAL_PASS
bias.mip_bias = view.mip_bias; bias.mip_bias = view.mip_bias;
#endif // MESHLET_MESH_MATERIAL_PASS #endif // MESHLET_MESH_MATERIAL_PASS
let Nt = pbr_functions::sample_texture( let Nt = pbr_functions::sample_texture(