Search Unity

Fog in Orthographic/GameObject Centered Fog

Discussion in 'Image Effects' started by OctagonalSquare, Aug 5, 2019.

  1. OctagonalSquare

    OctagonalSquare

    Joined:
    Mar 12, 2019
    Posts:
    4
    Ok so this is kind of a two-parter.

    I am currently working on a 2.5D platformer. I have two layers of tilemaps that the player can switch between to navigate levels. The player can also switch from orthographic to perspective camera and vice versa. I wanted to set up a fog effect to make the scene feel more real. However, there are two things that I want the fog to do that it doesn't:

    1. I want it to work in orthographic camera view
    2. I want to be able to make it center around the player not the camera (meaning, instead of the fog increasing with the distance from the camera, it increases with distance from the player.

    The orthographic part is the main one as what happens currently is that there is no fog until you switch to perspective, then it snaps onto the background objects and just looks weird when it does. The second is less important, but I want to do it so that when the player moves to the background, the fog is cleared around him.

    Are these possible with scripting or do ya'll know of any assets in the store that will allow either or both of these?
     
  2. brownboot67

    brownboot67

    Joined:
    Jan 5, 2013
    Posts:
    375
    I wouldn't bother doing this as an image effect. Just set your character world position to a shader global and use that in your environment shaders to do the fog.
     
  3. OctagonalSquare

    OctagonalSquare

    Joined:
    Mar 12, 2019
    Posts:
    4
    I’m not sure what you’re saying to do. I’m very inexperienced with the shader and effects side of unity (I’m a programmer more than anything). Could you explain what you mean? I’d really appreciate it
     
  4. brownboot67

    brownboot67

    Joined:
    Jan 5, 2013
    Posts:
    375