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
This commit is contained in:
atlv 2025-07-06 15:13:10 -04:00 committed by GitHub
parent 1579256709
commit baa88b98a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -251,7 +251,7 @@ fn fragment(@builtin(position) position: vec4<f32>) -> @location(0) vec4<f32> {
// 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;
}