Post Process Material: Occlusion Detection

Hi everybody,

i have written an easy pp material to get occluded pixel and put them in a mask.

But somehow it is wrong or i do not get it.

Thats the logic:

Thats the result (Objects are rendered in custom depth):

112008-occ_render.jpg

What i expected, is that there should only be white where the soldier is occluded from the box.

Can anyone give me the right kick. I do not get it :smiley:

Thanks in advance

raidfire.net

Unfortunately, custom depth is a single pass. It stores depth for all enabled meshes.
The only way is to set custom depth enable for one mesh, and not set it for another, then proceed to a depth tests.

For many objects may be used a custom stencil buffer, but as custom depth it only stores one pass (all of the meshes on single image with different colors, i.e. no overlapping).

In Your example You just subtracting A from A, which leads to 0 (black).

They are not (I haven’t tested them all, but sure for 99%).
I guess all of them are based on this:

and as You could see occluded objects only have one channel (yellow does not overlap red one):

Hi thanks for the fast reply. Not usual at weekend :smiley:

It seems that the marketplace outline assets works with multiple occlusion detection. Is there a solution for this? Stencil is not what i need. I need a sort of mask to catch all occluded pixels from objects with custom depth enabled.

Best would be within the pp material. There is another solution, but for this i have to put a routine in every material that are used for custom depth objects.

Thanks in advance

I have played around a little bit and now i have what i wanted :smiley:

Maybe we talked past each other.

This is the result that i wanted. Now i can query the stencils to get different looks

Oh, I thought You need more advanced version of this, like two masked objects to intersect. Sorry. Glad You’ve figured it out.