Masking out objects while keeping them visible in postprocess

Hello!
Ive created a postprocess material that creates emissive outlines of stencil “occluded” objects (behind other objects)
What Im trying to achieve, is to hide those “stencil” objects if they weren’t occluded.
One approach I tried was to use Opacity Mask in Masked opaque objects to hide object, but when I do that, the postprocess material wont “find” anything to create outlines of.
I also tried to find a way to actually hide those objects within the postprocess material, but apparently its not achievable as well.
Any ideas how can I achieve this?