Using fog to limit view distance?

I have an ocean in my world, and I currently have a post-process volume which changes a few things when the player is in the water, but how would I go about limiting the view distance? I would like to water to appear thick and dirty, what is the best way to go about this?

You could do it with an exponential heightfog -> just lower it to the water level and change some effects (e.g density, colour,…)
Otherwise take a look at this thread: https://answers.unrealengine/questions/133733/underwater-fog-half-in-and-half-out.html :slight_smile:

I am talking about having fog with distance, not height, so that the player can only see 5 feet in front of them regardless of which direction they are looking (vertically, horizontally), is there any way to accomplish this?

That’s why it’s exponential :p, just look at the documentation (https://docs.unrealengine/latest/INT/Engine/Actors/FogEffects/HeightFog/index.html)
It has starting distance, so you can tweak that so you can get the result you want.

1 Like

You could make a postprocess material that reads out the depth buffer. I tried it a little bit, but I could not get a nice fall-off. The best I could get was actually a subtract, but that led to color-distorions.

I used: Emissive-Color = SceneTexture:PostProcessInput0-clamp(SceneTexture:SceneDepth*1e-6,0,1)

1 Like

As Noah said, the Exponential Height Fog can give you just the effect you want with the right settings. Take a look at the example images at the end of the page!

Not sure if it’s helpful, but I was trying to figure out something similar and came up with this: Limiting View distance for a player - #5 by JerzMcDerz

I imagine you could use this method and add/remove the plane as needed. Add some “dirty” particles to the water volume to get the full effect you are looking for. Should get you close anyway.

GL!

image

3 Likes