Volumetric lighting not working properly in forward rendering

build 4.18.3

i have a test map which only has one static mesh in it about the size of a small office building. if i use the deferred renderer, the volumetric lighting works properly. When i change the renderer over to be FORWARD, close and restart and recompile the map again, the volumetric lighting now looks broken : it’s now drawing the fog as vertex coloring and as you move or look around, different vertices enter and exit the screen and so you can see the fake fog colors dancing around from vertice to vertice.

to reproduce :

  • set the renderer to be FORWARD in the project settings
  • close/restart
  • create new map (the preset that has a blue sky with a little flat cube to stand on)
  • take the floor cube, duplicate it and rotate it 90 degrees and put it as a wall on one end of the floor and make sure the side you picked is one that will now have that wall cast a shadow on the floor.
  • add an exponential height fog to map
  • set LOCATION = (0, 0, 10000)
  • set VOLUMETRIC FOG = on
  • set FOG DENSITY = 0.05
  • set FOG HEIGHT FALLOFF = .5
  • compile map’s lighting.

when the compile is done, fly the viewport around where the wall and floor meet and you’ll white vertex coloring popping in and out where the vertices are coming in and out of the view frustum so it looks broken. if you take a more complex map, you’ll see popping vertex colors EVERYWHERE so it right now makes the volumetric fog unusable if you’re using forward rendering. :frowning:

Hello,

We’ve recently made a switch to a new bug reporting method using a more structured form. Please visit the link below for more details and report the issue using the new Bug Submission Form. Feel free to continue to use this thread for community discussion around the issue.

https://forums.unrealengine.com/unreal-engine/announcements-and-releases/1410408-unreal-engine-bug-submission-form

Thanks

Hi indigosm,

This is not actually a bug, but a side effect of the forward renderer computing fog per-vertex by default. There’s a project setting under Forward Shading where you can disable this. Alternatively you can add more triangles to the mesh showing the artifacts.

oh awesome!!! thank you so much! i never would have found that option. :slight_smile:

this does not do anything - fog still does not show up if there is no geometry to be over - so a single object black space the fog only shows up where the object is

Summing up my practical experience with the situation where Exponential Height Fog stops working when switching to Forward rendering:

  • In Forward, EHFog only shows up when over geometry.
  • In Deferred, EHFog doesn’t need to be over geometry

In my case, the fog needed to appear over an empty geometry-free) area, so I added large Planes with WorldGridMaterial, ie “fake empty space”, and tweaked Fog Density and Fog Height Falloff so that the Forward scene solidly matched the Deferred version. This (adding geometry for the EHFog to interact with) of course won’t work for all situations.

Separately, if EHFog is appearing, but looks janky, check out Jon X’s comment above, ie uncheck the Vertex Fogging for Opaque option in Project Settings → Engine → Rendering or add more verts.

Summing up my practical experience with the situation where Exponential Height Fog stops working when switching to Forward rendering:

  • In Forward, EHFog only shows up when over geometry
  • In Deferred, EHFog doesn’t need to be over geometry

In my case, the fog needed to appear over an empty geometry-free) area, so I added large Planes with WorldGridMaterial, ie “fake empty space”, and tweaked Fog Density and Fog Height Falloff so that the Forward scene solidly matched the Deferred version. This (adding geometry for the EHFog to interact with) of course won’t work for all situations.

Separately, if EHFog is appearing, but looks janky, check out Jon X’s comment above, ie uncheck the Vertex Fogging for Opaque option in Project Settings → Engine → Rendering or add more verts.