Search Unity

Sprite Occlusion with Stencil Buffer for Surface Shader?

Discussion in 'Shaders' started by _eternal, Apr 27, 2016.

  1. _eternal

    _eternal

    Joined:
    Nov 25, 2014
    Posts:
    304
    I've been following this guide to create a sprite occlusion effect, where my sprite turns into a silhouette if it's blocked by another object.

    However, the guide is seemingly written as a Vertex and Fragment Shader for the default Sprite material. How can I adapt the code to make it work with a Surface Shader like in the default Sprite Diffuse material? I'm actually working with the Diffuse shader from MK Glow, but getting this to work with any shader that accepts light would be a start.