Fog volume in UDK popping againts translucent shader

Hi everyone,

I am working on an underwater scene in UDK and I am having a problem with the fog volume. The fog volume keeps popping in and out against the water shader above it. Im using a static mesh with FogVolumeConstantDensityInfo to create the fog volume. The water material is set to translucent and phong lighting.

The first image shows it displaying correctly and the second image is when it pops out against the water shader.

1

2

Has anyone else experienced this and know a way to fix it? Let me know if anymore details are needed the shader or fog volume.

-Joe

I do have another issue now but I believe it is part of the same thing. I am adding particle bubble effects to the scene and when the are in front of the full dense fog they alpha out and then come back when they are in front of the water mesh material. I have the particle material set to be used with fog so I am not sure what could be causing this. I added the photo to better show what I am trying to explain.

-Joe

Ok, so I was able to get the particles to show up correctly with the fog. I had to go into the fog actor properties and set the Approx Fog Light Color to the same color as the fog material since I am using fogvolumeconstantdensityinfo to create the fog from a mesh.

I am still having a slight issue with the particles disappearing when they are in front of the water mesh from certain viewpoints. It seems to be based on the axis I am looking down that causes this sorting issue to happen.

I apologise for my English and also for responding to this even though I do not have in-detail experience with UDK, but this looks to be a draw order/ sort order issue that occurs with non opaque items in many game engines, so I will try to offer information that is as engine-agnostic as possible, maybe it will help :slight_smile:

From your point of view (underwater), for this to look ok you would want to draw these two non-opaque elements always in this order:
1 - the top “sheet of water” then
2. - the “water fog volume”
(This is for an underwater camera; if we are talking about an above water camera, the order would be reversed)

It appears from the screenshots that the game engine sorts these two elements dynamically, and sometimes it draws ok but other times, based on camera position or angle, believes the top sheet of water is closer to the camera than the water fog volume and draws them in reverse order. This can happen sometimes depending on the sorting algorithm (it may be pivot based, or it may be bounding box based)

If you have access to any element properties/render flags that control the drawing order of these two elements, altering those in order to force your desired draw order will solve your problem.

The bubble particle issue is trickier, what appears to happen in the screenshot is that it gets drawn on the screen before the volumetric fog is applied, but the bubbles do not write their depth in the Z buffer, so the volumetric fog shader has no clue how far from the cammera the bubbles are, does not know how “foggy” they should get, so you are left with the already existing Zbuffer( or depth buffer) , written there by the pre-existing geometry.

Drawing the bubbles last will apparently solve the problem, and so will deactivating the fog on them, altering the fog color might also improve things, but the bubbles will never enter correctly the volumetric fog if the camera gets further away from them.

There are several ways to have the bubbles diplay ok AND be affected by the fog (more or less accurately)

a. Make the bubbles have a more “graphical pen” aspect by using an AlphaTest shader, not an alpha blend one, enable Z write on their shader and rely on a post-process AA algorithm to soften the ensuing jaggies. or

b. Dynamically link the bubble emitter to a parameter that gives the emitter’s distance from the render camera, and have all its particles fade out to 0 based on a linear relation of this parameter to a maximum fade-out distance established by you. (if that is possible in UDK)

c. and there are probably many other ways that I do not have a clue about :stuck_out_tongue:

Hope this would be of some help, :slight_smile:
Dragos Stanculescu