From 519ed5de42c9d872299a9b8b01933e052bf55595 Mon Sep 17 00:00:00 2001 From: Griffin <33357138+DGriffin91@users.noreply.github.com> Date: Mon, 13 May 2024 15:33:09 -0700 Subject: [PATCH] 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. --- crates/bevy_pbr/src/render/pbr_prepass.wgsl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/bevy_pbr/src/render/pbr_prepass.wgsl b/crates/bevy_pbr/src/render/pbr_prepass.wgsl index a679b7e160297..93032dfb96b78 100644 --- a/crates/bevy_pbr/src/render/pbr_prepass.wgsl +++ b/crates/bevy_pbr/src/render/pbr_prepass.wgsl @@ -54,18 +54,18 @@ fn fragment( #ifdef STANDARD_MATERIAL_NORMAL_MAP #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 - let uv = in.uv; + let uv = (material.uv_transform * vec3(in.uv, 1.0)).xy; #endif - // Fill in the sample bias so we can sample from textures. - var bias: SampleBias; + // Fill in the sample bias so we can sample from textures. + var bias: SampleBias; #ifdef MESHLET_MESH_MATERIAL_PASS - bias.ddx_uv = in.ddx_uv; - bias.ddy_uv = in.ddy_uv; + bias.ddx_uv = in.ddx_uv; + bias.ddy_uv = in.ddy_uv; #else // MESHLET_MESH_MATERIAL_PASS - bias.mip_bias = view.mip_bias; + bias.mip_bias = view.mip_bias; #endif // MESHLET_MESH_MATERIAL_PASS let Nt = pbr_functions::sample_texture(