Search Unity

[solved] Help with stencil shader

Discussion in 'Shaders' started by TitoOliveira, Nov 29, 2019.

  1. TitoOliveira

    TitoOliveira

    Joined:
    Aug 4, 2014
    Posts:
    48
    I have this quad that is writing to the stencil buffer, which is my stencil mask. Over to the right there is an opaque cube that is working as intended, the quad masks it.

    At the bottom i have a water shader that has a gradient color based on depth. But the quad is messing with the effect. I thought it would simply be ignored, since it doesn't do any stencil stuff, but i guess the screen depth information accounts for it. Not sure how could i ignore it.

    And at the left i have an additive particle effect that reads the stencil just like the cube does. But it only gets masked correctly by the quad if the particle effect is in front of it. When i move them behind the mask, they get occluded. What's up with that?

    Thanks for the help

     
  2. TitoOliveira

    TitoOliveira

    Joined:
    Aug 4, 2014
    Posts:
    48
    All problems were solved by disabling receive and cast shadows on the Stencil Mask shader