Download

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: Underwater fog, half in and half out - UE4 AnswerHub :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.com/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.

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)

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!