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. Dismiss Notice

Global Fog

Discussion in 'Shaders' started by BigB, Mar 5, 2015.

  1. BigB

    BigB

    Joined:
    Oct 16, 2008
    Posts:
    672
    Hi,

    The Globlafog shader in the current version of Unity5, is really bad.
    GlobalFog in the RC1 version, we could setup correctly the distance , and the height fog, in the current version besides being impossible to do so, the visual result is bad bad bad.
    Was there a reason why the GlobalFog was changed ?
    Also, Fog color on the shader cannot be changed from script anymore.
    Right now looks much better to use the old Deferred lighting path with the option to have (linear, exp or exp2) that using the useless GlobalFog shader.
     
  2. Paulohmm

    Paulohmm

    Joined:
    Dec 24, 2012
    Posts:
    18
    You can change the fog mode, and its values by script, like this:

    Code (csharp):
    1.  
    2. RenderSettings.fog = true;
    3. RenderSettings.fogColor = Color.black;
    4. RenderSettings.fogDensity = 1;
    5. RenderSettings.fogMode = FogMode.Exponential;
    6. RenderSettings.fogStartDistance = 10;
    7. RenderSettings.fogEndDistance = 100;
    8.  
    I believe that is working just as in Unity 4
     
  3. BigB

    BigB

    Joined:
    Oct 16, 2008
    Posts:
    672
    That works with the Fog settings that you can find in the Lighting Tab, but that won't work with the Global Fog script that you must use if you use the new Deferred mode.
     
  4. Paulohmm

    Paulohmm

    Joined:
    Dec 24, 2012
    Posts:
    18
    The GlobalFog script take its values, based on those defined on the Render Settings.

    I just tested and worked perfectly
     
  5. BigB

    BigB

    Joined:
    Oct 16, 2008
    Posts:
    672
    On the GlobalFog script, use "Absolute Y and Distance", "Absolute Y" or "Relative Y and Distance".
    It won't work.
    On my side only works when I have "Distance" selected.
     
  6. Paulohmm

    Paulohmm

    Joined:
    Dec 24, 2012
    Posts:
    18
    The script that I have here seems to be different than yours. The settings that I have are these: Sem título.png
     
  7. Paulohmm

    Paulohmm

    Joined:
    Dec 24, 2012
    Posts:
    18
    I reimported the ImageEffects, to make sure that I possessed the version shipped with Unity 5.

    Try reimporte the GlobalFog on your project
     
  8. BigB

    BigB

    Joined:
    Oct 16, 2008
    Posts:
    672
    yup, that's no my shader.
    Will do that !

    Thanks !
     
  9. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,782
    If you don't like it just change it :D
    GlobalFogUI.PNG
     
  10. BigB

    BigB

    Joined:
    Oct 16, 2008
    Posts:
    672
    showing off ? :cool:
     
  11. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    2,782
    yeah...i shouldn't . . .sorry :p
     
  12. BigB

    BigB

    Joined:
    Oct 16, 2008
    Posts:
    672
    haha
     
  13. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,784
    I agree the new global fog is a real step back. Even the options / labelling seems to not work as intended. Unity is also now forcing the DepthTextureMode in the image effects which is interfering with other custom effects elsewhere... this is a really disappointing move.
     
  14. jroto23

    jroto23

    Joined:
    Oct 19, 2015
    Posts:
    82
    Hey guys, do I put this global fog script on the main camera?