Search Unity

Highlighting Stencil Mask Pixels

Discussion in 'Shaders' started by noethis, Jul 19, 2019.

  1. noethis

    noethis

    Joined:
    Nov 11, 2013
    Posts:
    129
    I'm using stencil masks to look through portals into other scenes and I'm trying to figure out how to modify the final pixel color of the stenciled pixels. Currently I have 2 passes set up, one that sets the stencil buffer and another that clears the depth buffer (per this thread). Is a 3rd pass on the stencil mask the way to go? I quickly tried it and am not getting any color changes. Any ideas?

    E.g. - want to be able to tint the final pixel color inside the box here

    asdf.PNG
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,336
    Yes, a third "pass" would be the way to go. More specifically a separate material that renders at a later queue, otherwise the other objects will just render over it as if it's just a third pass later rendered objects will always render on top.
     
    noethis likes this.