DepthMask - Seeing behind objects

Hello

I need some help to create a Depthmask like in unity :
If I use the customdepth, I can’t see the scene behind the object
I was thinking about using “raymarching” system to create a 3D mask that start from the window to a special location that give us a 3D box mask, with the same direction of my camera. But i think that it’s a bit too much for this effect …



Thank you very much !

I just create an example with a material system :

The problem is that I have a cone views instead of pyramidal. If we can create the same CameraView for the mask starting from the window, it could works.

In red it’s what i have
In green it’s what i want

Thank you