# Using fog to limit view distance?

**URL:** <https://forums.unrealengine.com/t/using-fog-to-limit-view-distance/34307>\
**Category:** Rendering\
**Tags:** Fog, unreal-engine\
**Created:** [July 4, 2015, 8:31pm UTC](https://forums.unrealengine.com/t/using-fog-to-limit-view-distance/34307 "2015-07-04T20:31:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![JmDevTx](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JmDevTx](https://forums.unrealengine.com/u/JmDevTx)\
**Post date:** [July 4, 2015, 8:31pm UTC](https://forums.unrealengine.com/t/using-fog-to-limit-view-distance/34307/1 "2015-07-04T20:31:12Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_923c79df](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_923c79df](https://forums.unrealengine.com/u/anonymous_user_923c79df)\
**Post date:** [July 10, 2015, 9:03pm UTC](https://forums.unrealengine.com/t/using-fog-to-limit-view-distance/34307/2 "2015-07-10T21:03:49Z")

</div>

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](https://answers.unrealengine/questions/133733/underwater-fog-half-in-and-half-out.html) 🙂

---

<div class="post-metadata">

**Author:** ![JmDevTx](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JmDevTx](https://forums.unrealengine.com/u/JmDevTx)\
**Post date:** [July 10, 2015, 9:29pm UTC](https://forums.unrealengine.com/t/using-fog-to-limit-view-distance/34307/3 "2015-07-10T21:29:22Z")

</div>

> [@;329287](#):
>
> 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](https://answers.unrealengine/questions/133733/underwater-fog-half-in-and-half-out.html) 🙂

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?

---

<div class="post-metadata">

**Author:** ![Noah\_Artwork](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/noah_artwork/32/1086033_2.png) [@Noah\_Artwork](https://forums.unrealengine.com/u/Noah_Artwork)\
**Post date:** [July 11, 2015, 1:22am UTC](https://forums.unrealengine.com/t/using-fog-to-limit-view-distance/34307/4 "2015-07-11T01:22:41Z")

</div>

That’s why it’s exponential :p, just look at the documentation ([https://docs.unrealengine/latest/INT/Engine/Actors/FogEffects/HeightFog/index.html](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.

---

<div class="post-metadata">

**Author:** ![isgoed](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@isgoed](https://forums.unrealengine.com/u/isgoed)\
**Post date:** [July 20, 2016, 11:28am UTC](https://forums.unrealengine.com/t/using-fog-to-limit-view-distance/34307/5 "2016-07-20T11:28:56Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![HavocX](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@HavocX](https://forums.unrealengine.com/u/HavocX)\
**Post date:** [July 20, 2016, 11:28pm UTC](https://forums.unrealengine.com/t/using-fog-to-limit-view-distance/34307/6 "2016-07-20T23:28:21Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![JerzMcDerz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JerzMcDerz](https://forums.unrealengine.com/u/JerzMcDerz)\
**Post date:** [July 23, 2023, 4:21pm UTC](https://forums.unrealengine.com/t/using-fog-to-limit-view-distance/34307/7 "2023-07-23T16:21:21Z")

</div>

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](https://forums.unrealengine.com/t/limiting-view-distance-for-a-player/291413/5)

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!

---

<div class="post-metadata">

**Author:** ![jwatte](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jwatte/32/744941_2.png) [@jwatte](https://forums.unrealengine.com/u/jwatte)\
**Post date:** [July 23, 2023, 4:35pm UTC](https://forums.unrealengine.com/t/using-fog-to-limit-view-distance/34307/8 "2023-07-23T16:35:06Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/8/f/e8fe3b39b36e9e1160d287c2bd35ed108c92e8af.png)
