I just can’t get my shader example to work.
I use unlit shaders for all object types.
Idea is simple:
- First object, is closer to the camera then most, type of Sprite, it uses unlit Shader, which simply writes value 100 to stencil buffer based on texture alpha channel data.
- Second object is underneath the first object, uses unlit Shader, which instructs to pass stencil test if ref value is less then value in buffer.
Should work, but it doesn’t.