Water surface and fog ?


I own a few water shaders from the marketplace and they all behave incorrectly when the exponential height fog is on.

Here’s a picture of the same scene without any fog and with an extreme fog:

As you can see, the water surface seems unaffected by the fog.

Any idea why ?


Is the water mesh a giant plane, thus probably only 4 verts for each corner? What ‘lighting type’ is the water material?

I don’t remember if the old lighting models for translucency(per vertex, directional, etc) can be fogged or not, but perhaps the default vertex fogging isn’t working for you because the mesh isn’t triangulated enough or the per-pixel fogging isn’t enabled. Either option should work, just depends on where you want to put the cost.

Do you have an Atmospheric Fog actor in your scene too btw? I know awhile back translucency was never fogged correctly with both fog actors. I haven’t used the atmospheric one in awhile to know for sure with the latest versions.

Hello Rosegoldslugs,

Thanks a lot, you solved my problem in two different ways !

First, the “compute fog per pixel”, which i didn’t know, did the trick.
Anyone getting this problem, the first solution is here:

A very nice news is that this doesn’t seem to affect the perfs at all (at least in my setup), in fact, i ran a test with a large amount of water and couldn’t see any change in the displayed fps.

Next, yes, i have both atmospheric and exponential fogs.
As a test, i turned off the fog/pixel option, then turned off the atm fog (hidden in game = true) and again, it worked well.
So second solution anyone: don’t use atm and exp fogs together.

I need both fogs so i’m going to stick with the first solution (fog/pixel), especially as it doesn’t bring any perf issue in my game.

So a huge thank for your answer :slight_smile:

Now to answer your questions, in case it’s relevant for anyone willing to understand what’s going on:

My levels are generated at runtime and can have height variations so i can’t use a single large plane for water. Instead my water is composed of multiple small squares.
Here is the same scene without and with the green surrounding. You can see that without the surroundings the water is just a set of square cells.

The lighting mode is “surface transluency volume” (as can be seen in the hereabove capture, where i have only changed the “fog/pixel” option).

Thanks again :slight_smile: