Custom Depth Stencil is an extension of Custom Depth where you can use a stencil, or cutout, of your rendered object to then do visually interesting things like the example below that enables you to
visualize occlude objects, draw object outlines, or only be visible from certain viewing angles. There is a lot of potential with what you can do by having access to the stencil of an Actor in your
scene. Using the following settings to enable and assign a stencil value.
In this scene, Custom Depth is enabled on three objects and a Custom Depth Stencil Value is set for each, but without any post processing pass to visualize the content, this feature remains invisible.
Once you've setup your Post Process Material you will be able to visualize how the Custom Depth Stencil looks, The occluded objects render with a randomly assigned color based on the Custom Depth Stencil Value used.
This is a setup of the Material we used to visualize it:
Click image for full size.
This is by no means, the only way to use Custom Depth Stencil and in this particular Material setup the stencil is being divided so that it uses values between 1 and 255, a mask is being used
for any value that is between these values, a random color is being created for these values as well so as the Custom Depth Stencil Value changes so does the color, and finally the mask that is
created is being used in a way that only colors the stencil if the object is occluded.