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

fading material based on distance from camera

Discussion in 'Shaders' started by Footers, Mar 22, 2013.

  1. Footers

    Footers

    Joined:
    Sep 8, 2009
    Posts:
    49
    I'm trying to overcome some nasty anti-aliasing issues I''m seeing on some thin white polygons, against a dark grey background that need to be visible when viewed up close but as the camera draws away could fade to dark grey/transparent to avoid the anti-aliasing flickering due to the small size of the lines and the harsh contrast difference between the white and the dark grey. Could I alter the material colour based on distance from the camera? I'm not a coder but can cut and paste :) if someone were to be so kind as to offer a solution.

    Apart from the idea above, has anyone got any other ideas that could help me?

    Thanks in advance.
     
  2. aubergine

    aubergine

    Joined:
    Sep 12, 2009
    Posts:
    2,878
    Dont you use fog in your game?
     
  3. Footers

    Footers

    Joined:
    Sep 8, 2009
    Posts:
    49
    No and I only want to apply the fading to these specific 'thin' objects, the rest need to be visible still when viewed from a distance.