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

Fog color lerp not working well

Discussion in 'Scripting' started by vegenarie, Jun 7, 2014.

  1. vegenarie

    vegenarie

    Joined:
    Jan 5, 2011
    Posts:
    287
    I am trying to change fog color smoohtly but it just changes like in jumps of different colors, it goes to a green color, then to a reddish color, and not smoohtly either. I have used color lerp many times before but with fog color seems not to work well.
     
  2. vegenarie

    vegenarie

    Joined:
    Jan 5, 2011
    Posts:
    287
    I have printed the result of the color lerp and it is done well, dont know why fog color changes dont go well, seems fog color changes cant be done smoohtly?
     
  3. ElvisAlistar

    ElvisAlistar

    Unity Technologies

    Joined:
    Oct 2, 2013
    Posts:
    226
  4. vegenarie

    vegenarie

    Joined:
    Jan 5, 2011
    Posts:
    287
    I have used fog color lerp in a very similar project and it works fine, dont understand why with same code it fails in a project and not in the other.
     
  5. ElvisAlistar

    ElvisAlistar

    Unity Technologies

    Joined:
    Oct 2, 2013
    Posts:
    226
    Maybe post the actual code you're using, so that others can try it locally on their machines and give you more feedback.
     
  6. vegenarie

    vegenarie

    Joined:
    Jan 5, 2011
    Posts:
    287
    I found the problem but not the solution. If i use gamma space fog color lerp works fine, and if i use linear it doesnt work well, maybe it doesnt work well cause it needs Pro to work well?. But linear makes the scene much better looking, so fog is a bit useless unless there is a way to make the objects you want to use linear.
     
    Last edited: Jun 9, 2014
  7. x70x

    x70x

    Joined:
    Aug 20, 2011
    Posts:
    49
    I'm having this exact same problem right now... why does lerping the fog color behave differently between gamma and linear modes?
     
  8. gronostaj

    gronostaj

    Joined:
    Feb 4, 2016
    Posts:
    1
    That's what gamma is supposed to do. It's nicely explained here: