Horizontal lines on local fog from far away

Hello.

We are working on very large scale environments and we need to place local fog volumes that we must see both from ground views but also from aerial views. However when using UE’s local fog volume or custom made volumetric fog shaders we have horizontal lines cutting through said fogs that start to appear from a specific distance. I found the following cvars that were helping on limiting said banding but even after a certain distance it doesn’t fix the issue. Is there a way to work around or even a fix for this?

r.VolumetricFog.GridPixelSize

r.VolumetricFog.GridSizeZ

Best regards.

Steps to Reproduce

See screenshots. The farther we are the more we see horizontal lines.



Hi there,

Without knowing what your custom volumetric fog shaders look like I can only guess there’s likely some depth issue, likely related to one or both of these issues:

SceneDepth and ConvertFromDeviceZ() precision discrepancy and fixes: [Content removed]

Sampling depth when using resolution or render target scaling: [Content removed]

If neither of those helps, please provide more details about your custom shaders and how they sample depth.

I also tried a constant parameter to drive the extinction and see if the banding was still happening and it still does. I think this is happening in the fog grid/rendering path.

I was also able to reproduce the issue in latest with constant extinction and agree this is likely an issue with how the fog is rendered at this scale with the froxel grid. Using r.VolumetricFog.Filtering.Quality 3 and r.VolumetricFog.UpsampleJitterMultiplier 1 helps a little, but the grid lines are still there and require further investigation which is ongoing.

The banding is caused by the size of individual froxel slices at the distance being very large. When the thin fog volume is voxelized into the VolumetricFog.VBufferA which is used in Light Scattering and Final Integration - the fog volume intersects the froxel volume at an angle so that if you looked at the VolumetricFog.VBufferA from the side, it’d look like stairs. This is something you can see in a PIX capture. When the fog is applied in Exponential Height Fog > Fog pass this has the effect of treating that fog volume like stairs where each “stair” is in a different slice. This gives you alternating thicknesses of fog across the surface instead of the expected constant amount of fogging over the surface.

You cannot easily mitigate this in a performant way with the volumetric fog technique when you want to have thin volumes at far distances. Using r.VolumetricFog.Filtering.Quality 3, r.VolumetricFog.Jitter 1, r.VolumetricFog.UpsampleJitterMultiplier , increasing r.VolumetricFog.GridSizeZ and adjusting r.VolumetricFog.DepthDistributionScale will help, but will take increasing amounts of memory, lower performance and may sacrifice quality closer to the view. If the camera will always be distant, you can increase the near plane and decrease the far planes of the volume by setting the Volumetric Fog > Start Distances and View Distance on your ExponentialHeightFog component to tightly fit the volume and not waste froxel space, but you’d need to adjust this carefully if you do it at runtime because the temporal reprojection isn’t aware of these changes and turning off r.VolumetricFog.TemporalReprojection will lower quality noticeably.

I recommend instead you lower the volumetric fog view distance on the ExponentialHeightFog component and rely on exponential height fog for the thin ground fog from a distance because it doesn’t render into a froxel grid past the view distance. Local fog volumes will also render without the same stepping effect from a distance when they’re not withing the volumetric fog view distance limit. You can also set r.LocalFogVolume.RenderIntoVolumetricFog=0 if you want to keep the local fog volumes out of the volumetric fog grid at any distance.

You can still use volumetric fog in the near distance where the grid provides acceptable resolution.

I hope this helps, and please let me know if you have additional questions and if there’s a reason you want to use volumetric fog at far away distances.

Hello Alex.

Here is what the custom shader looks like. (max quality allows to zoom to 100% on the screenshot)

[Image removed, no longer available]Custom node:

float3 BoundsMin = GetPrimitiveData(Parameters).LocalObjectBoundsMin.xyz;

float3 BoundsMax = GetPrimitiveData(Parameters).LocalObjectBoundsMax.xyz;

size = BoundsMax - BoundsMin;

return BoundsMin;

As you can see I am using the Absolute world position and I do some calculations to feed the extinction channel. Now I have read what you shared in the other links but I am not sure if I can try what you recommended there since it talks about post process materials and rvt which I don’t use here.

I don’t know if that would help you but in case that could be of any help I also need to crank the value way above the slider’s maximum of the Exponential Height Fog actor’s View Distance in the Volumetric Fog section. Otherwise the mesh I am using with the custom shader would disappear way too early when I am going at “high” altitudes.

On a final note I also tried to go stupid simple and used a constant parameter to drive the extinction and see if the banding was still happening and it still does. I think this is happening in the fog grid/rendering path.

Alright. I will be waiting for your feedbacks.

Edit : More informations in case that can help you guys : The same visual banding is happening with volumetric clouds as well. I created a dedicated cloud layer in my custom volumetric cloud material so that I could set it to the ground level to fake a ground fog and there is exactly the same issue.