- Home /
Unity 5 Global Fog height?
I'm trying to have my level fade upwards into black. In 4.6, I used Global fog to do this, but when I'm try to do the same with Unity5, no matter what settings I change it always just acts like normal fog. Things fade to black (or whatever color I set the fog to in the lighting menu) based on their distance from the camera. It completely ignores the height setting.
Anyone know a solution to this problem?
I've decided to just use the old GlobalFog.js and GlobalFog shader files from Unity 4. You can download them here - http://unity3d.com/get-unity/download/archive
Answer by FortisVenaliter · Aug 20, 2015 at 09:23 PM
You need to use the new Fog post processing shader on the camera. It can be imported with the built-in "Effects" package. Not sure if that's in the non-pro version though.
Are you talking about global fog? Because that's what I've been using :(
The height option doesn't seem to do anything in the new (Unity 5) GlobalFog post processing script/shader.. Unless I'm missing something.
It seems to work for me, but it's only when the height is below the specified value. I'm using deferred path, other regular settings. Should be pretty easy to modify the global fog shader from there to reverse the direction.
But also, keep in $$anonymous$$d the fog does not affect the skybox. Only level geometry.
You're right - it does work. I didn't play around with it enough. The problem was with the other options I had set. With "Distance Fog" also ticked, the fog was dense enough that I couldn't see the limited height part changing. When I reduced the density of the Fog under the Lighting window, Scene tab, I could see it. (Also, if Fog is ticked as well as using the GlobalFog script, it doubles the intensity of the distance style fog).
Answer by alexandresk · Oct 31, 2016 at 02:58 PM
I was having the same problem and find the solution.
First have to call
using UnityStandardAssets.ImageEffects;
I can access bloom with that but not Global Fog. It is just because global fog is not public, so open the script and change the
class GlobalFog : PostEffectsBase
to
public class GlobalFog : PostEffectsBase
and access with
yourcamera.GetComponent<GlobalFog>().height = value