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

Projector shader to display texure above everything else

Discussion in 'Shaders' started by BitteWenden, Feb 21, 2017.

  1. BitteWenden

    BitteWenden

    Joined:
    Apr 24, 2015
    Posts:
    7
    Hey, I want to project a texture onto my gameworld, and I want it to be above everything else (so it should basically replace the color that is already there, if the color in the texture isn't white or transparent). However, I can't really find out how to do that, the multiply shader bundled with Unity and the additive blending won't work since then black on my map will still be black. In the image you can see what it looks like with the multiply shader. Also the black lines on the tile meshes are a seperate material, that seems to be a problem sometimes.

    What I tried so far was making the parts where the texture is not transparent/white completely black and then try to replace the black with the actual color in a second pass, however I found no way of getting the original color (to see if it's black or not), and it would also replace "normal black". Any idea how to do that?
     

    Attached Files:

  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    You'll want an alpha blend projector shader.