Tricubic volumetric fog filtering broken: h0.z overwritten in SampleVolumetricFogFiltered

Summary

r.VolumetricFog.Filtering.Quality 2 (tricubic) samples the wrong depth because h0.z is overwritten.

What Type of Bug are you experiencing?

Rendering (Graphics / Niagara)

Steps to Reproduce

Add an exponential height fog with volumetric fog and a spot light with volumetric scattering.
Set r.VolumetricFog.Jitter 0 so the edge is static.
Compare r.VolumetricFog.Filtering.Quality 0, 1 and 2 at the cone edge near the light.

Expected Result

File: Engine/Shaders/Private/HeightFogCommon.ush, SampleVolumetricFogFiltered(), line 492.

Description: The B-spline setup shared by bicubic and tricubic ends with:

hlsl
h1.xy = min(h1.xy, View.VolumetricFogUVMax);
h0.z = VolumeUV.z;

h0.z = VolumeUV.z is correct for bicubic, which filters only in XY and samples Z linearly at the original depth. The tricubic branch also uses h0.z and h1.z with the g0.z weight: lerp(tex001, tex000, g0.z). So in Z it blends the unfiltered depth with the B-spline offset h1.z, and the Z filter is wrong. In practice, quality 2 looks about the same as trilinear (froxel steps along spot light edges stay visible) or worse, while quality 1 smooths them correctly.

Observed Result

Suggested fix: move h0.z = VolumeUV.z; inside the #elif PERMUTATION_VOLUMETRIC_FOG_FILTERING_QUALITY == 1 branch, so tricubic keeps the computed h0.z.

Affects Versions

5.8

Platform(s)

Windows

Pull Request: https://github.com/EpicGames/UnrealEngine/pull/15392