Search Unity

LWRP Fog

Discussion in 'Shaders' started by jessecason8, Feb 15, 2019.

  1. jessecason8

    jessecason8

    Joined:
    Feb 15, 2019
    Posts:
    2
    Hello, I just started using Unity yesterday to learn basic stuff and was watching Brackeys on youtube. Watched his LWRP shader videos, decided to try it out and now fog just doesn't work right. Basically anything below the player just gets colored the same as fog, but anything on the same Y level is fine. This is using the fog under lighting > other settings. I think I should be using a different fog it the scene settings game object, but I have no clue how to make that work because simply checking it does not. Here is what is happening:

    This is at the start
    upload_2019-2-14_22-54-49.png

    And this is 86 units forward.
    upload_2019-2-14_22-54-35.png

    Note that the small cubes and the floor are literally copy and pasted the same material/object all settings same and all that. Anything below y = 1, the blue cube y level just turns black (with black fog obviously) after about this distance. Thanks for any suggestions anyone has.
     
  2. jessecason8

    jessecason8

    Joined:
    Feb 15, 2019
    Posts:
    2
    No replies feels bad. :(
     
  3. AndreRieu

    AndreRieu

    Joined:
    Mar 25, 2019
    Posts:
    1
    Brutal! Trying to work out the same thing...
     
  4. Dawdlebird

    Dawdlebird

    Joined:
    Apr 22, 2013
    Posts:
    88
    A bit late perhaps, but what does the geometry you're using look like? Fog coordinates get calculated in the vertex shader, and these values are interpolated in the fragment shader. If you move forward on your piece of geometry causing the first vertices to fall out of clipping space (the vertices within the camera frustrum), the shader won't have those vertices to work with, and what you might be seeing is simply the fog distance of the next available vertices. Try adding a few subdivisions to your (road?) geometry and see if that fixes your problem.
     
  5. SebasAlexander

    SebasAlexander

    Joined:
    May 18, 2018
    Posts:
    2
    Did you solve it ? I have the same issue