From baa88b98a36bf0af584a135cd30bd5847e4c2d4e Mon Sep 17 00:00:00 2001 From: atlv Date: Sun, 6 Jul 2025 15:13:10 -0400 Subject: [PATCH] fix variable-termination loop gradients by sampling specific lod (#19988) # Objective - Calculating gradients in variable-termination loop is bad, and we dont need to here ## Solution - Sample mip 0 always ## Testing - volumetric_fog example --- crates/bevy_pbr/src/volumetric_fog/volumetric_fog.wgsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_pbr/src/volumetric_fog/volumetric_fog.wgsl b/crates/bevy_pbr/src/volumetric_fog/volumetric_fog.wgsl index 058f73fca9..43e3fc9278 100644 --- a/crates/bevy_pbr/src/volumetric_fog/volumetric_fog.wgsl +++ b/crates/bevy_pbr/src/volumetric_fog/volumetric_fog.wgsl @@ -251,7 +251,7 @@ fn fragment(@builtin(position) position: vec4) -> @location(0) vec4 { // case. let P_uvw = Ro_uvw + Rd_step_uvw * f32(step); if (all(P_uvw >= vec3(0.0)) && all(P_uvw <= vec3(1.0))) { - density *= textureSample(density_texture, density_sampler, P_uvw + density_texture_offset).r; + density *= textureSampleLevel(density_texture, density_sampler, P_uvw + density_texture_offset, 0.0).r; } else { density = 0.0; }