Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Unity 5 Global Fog issue. Can't get it to show up above the terrain / in front of the skybox?

Discussion in 'Editor & General Support' started by addicus, May 13, 2015.

  1. addicus

    addicus

    Joined:
    Apr 6, 2014
    Posts:
    25
    Images for reference: http://imgur.com/a/pFLYO

    I've tweaked just about every setting possible between the fog settings and the global fog effect. Am I missing something basic here? I'm new to unity so please let me know if I'm missing something stupid haha.

    I just want the fog to extend above the character's head and cover up the skybox so that it looks like the snow in my scene is coming out of a haze of fog / low cloud. Like this:


    Thanks!
     
  2. addicus

    addicus

    Joined:
    Apr 6, 2014
    Posts:
    25
    To clarify:

    I'm not trying to apply the fog to the skybox directly, I'm trying to create a global fog effect on the player camera so that the fog appears in a sphere around that camera. You can see the effect working in this link:


    Notice how he is able to apply the fog in a sphere that occludes the skybox. Is this effect just broken in unity 5?
     
  3. addicus

    addicus

    Joined:
    Apr 6, 2014
    Posts:
    25
  4. addicus

    addicus

    Joined:
    Apr 6, 2014
    Posts:
    25
    Anybody? Is this just broken in Unity 5?
     
  5. addicus

    addicus

    Joined:
    Apr 6, 2014
    Posts:
    25
    Bah just realized that this forum wasn't keeping my youtube time stamps in place. The place to get a good look at what I want is around the 4 mins 5 seconds mark onward in the video in the first two posts.
     
  6. addicus

    addicus

    Joined:
    Apr 6, 2014
    Posts:
    25
    Update: I just tested it with the default and a few other skyboxes and have the same result. Here's a video I just recorded of how the height / global fog wont go over my skybox and creates an ugly look:



    In the video I'm adjusting the global fog height, and height density settings.

    So I guess my real issue isnt that global fog doesnt work, but that rather it wont show up in front of the skybox.

    Any ideas?
     
  7. addicus

    addicus

    Joined:
    Apr 6, 2014
    Posts:
    25
    YESSSSSSS found a solution via reddit / here: http://www.reddit.com/r/Unity3D/comments/363o23/unity_5_global_fog_is_broken_does_it_work_on_your/

    Solution:

    Indeed, the fog works as it should by the video
    Go in the GlobalFog.shader and find the line "// Do not fog skybox"
    Remove the height check there or play with its value to see if you can get the effect you want

    YOU ARE A GOD!
    commenting out / removing these lines did the trick:
    //if (rawDepth >= 0.999999)
    // fogFac = 1.0;

    Thanks so much!
     
  8. addicus

    addicus

    Joined:
    Apr 6, 2014
    Posts:
    25
    Ok new problem :)

    Just ran into another issue with this shader regarding particle effects. Any idea how to get the fog to apply the proper value on top of the particle effect? Tried searching the shader for 'particle', 'effect', etc with no luck. Thanks!

    Image: http://i.imgur.com/QGCBDbb.jpg
     
  9. bartm4n

    bartm4n

    Joined:
    Jun 20, 2013
    Posts:
    57
    I was having the same issue, and also another in which the SpeedTree billboards that have nothing but the skybox behind them are not affected by Global Fog whatsoever. They pop in and out very badly as a result. Any thoughts?

    EDIT:
    I forgot to include that it is very similar to the problem in this other thread, but using the default Unity SpeedTree shaders http://forum.unity3d.com/threads/billboard-trees-not-showing-fog.309629/