Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Fog material shader?

Discussion in 'Editor & General Support' started by Zebbi, Aug 18, 2019.

  1. Zebbi

    Zebbi

    Joined:
    Jan 17, 2017
    Posts:
    521
    I'd like to try and emulate the old sector-based lighting effect 90's games used to use. It was basically per-sector black-fog that could be set to a maximum amount, and then it would change darkness based on your distance from it:


    I'd like to do this with a shader, so I can control how dark the black-fog is on each face of a wall or floor, and also so some walls don't have any black-fog at all (all bright, effectively). As you can see in that example, some of the walls of the arena stay bright and fully "lit" at all distances, a couple of the walls go fully black at a closer distance and some of them go to full black at a much further distance: