Render different color by depthMap with shader

Welcome aboard!

There’s a simply way to do this, which is to clone the plane and apply a material with an inverted depth function (GREATER). This way the plane will only be rendered when it is occluded by something.

For this to work, the plane must be rendered last, after all possible occluders have updated the depth buffer.

In this PG, I used a rendering group id of 1 for the sprites, to make sure that they are rendered last:

Also, this could help:

2 Likes