Download

Can I use an object's visibility as a mask for an opaque material? Custom Depth? Render Targets?

So I want to capture the visibility of an object and use this as a white against black mask to mask out aspects of an opaque material.
I got so far with Custom Depth (although I couldn’t actually see it working, all was black) and SceneTexture, but realised this was only possible with Translucent materials.
So to clarify:
Let’s say a sphere is occluded by smaller spheres. I want only the visible parts of the larger sphere as white against an otherwise black mask. I then want to use this image, in real time, as a mask to be used in a lerp mode.
Is this something I need to do with Custom Depth, Render Targets, Post Process Materials and the like? If so, how?
Any help on this is greatly appreciated - I’m so close to achieving greatness, this seems to be the final hurdle!

It depends on what exactly you’re wanting to do with that mask once you have it. The mask should be easy enough to make using Depth Stencils.