Search Unity

  1. How can our website serve you better? Give us your feedback. Take our survey and let us know.
    Dismiss Notice

Issue with fog

Discussion in 'Editor & General Support' started by jermaine, Mar 25, 2010.

  1. jermaine

    jermaine

    Joined:
    Feb 10, 2009
    Posts:
    28
    Hello I am trying to develop a scene thatwhen a player goes underwater, it kinda has a underwater effect.
    I put the following in the fixed update function in my player.

    Code (csharp):
    1.  
    2. ...
    3.     //my water addon
    4.    var underwater = 8.24;
    5.    if(transform.position.y < underwater)
    6.    {
    7.       color = Color (56.0, 166.0, 198.0, 122.0);        
    8.       RenderSettings.fogColor = color;
    9.       RenderSettings.fogDensity = 0.1;
    10.    }
    11.    else
    12.    {
    13.       color = Color (78.0, 163.0, 163.0, 255.0);// was 78.0, 142.0, 149.0, 122.0
    14.       RenderSettings.fogColor = color;
    15.       RenderSettings.fogDensity = .0004;        
    16.    }
    17.  
    18.     //end water
    19.  
    20.  
    My problem is that the fog shows up when the player is underwater, but it is always white. I tried changing the color, but its not working..
    I'm trying to give it a blueish color.

    Is this a known bug in Unity or am I doing something wrong?
    Can I get some help?

    Thanks in advance.
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,307
    Color values range from 0 to 1. Both colors you used are white, or rather, way beyond white.

    --Eric
     
unityunity