Outline Post Process Occlusion

Hi all!

the image below summarizes very well what I’m trying to achieve.

The post-process material that I’m currently using is the one created by Tom Looman.

Basically i want to achieve the effect on the right working inside the material itself but i can’t figure out how to do so.

Thanks for your attention!!

You can compare the depth, choose the pixel closer to the camera.