Hello, I’m trying to view my character behind walls, so I wrote a shader with a first pass ZTest Greater then ZTest LEqual, it works but my character is made of multiple materials.
That means that if his hand is behind his head or any other part (and viceversa) the hand will be visible. How can I avoid that? Somehow exclude same shader materials?
As an extra pass at the beginning, draw only the backfaces of your object with ZTest LEqual so it only draws behind the wall (this is so we overwrite the depth buffer, punching a hole in the walls depth the shape of your character). After that, draw your character normally with normal ZTesting.
You could also try something crazy with stenciling… but I won’t go there unless you ask me to.