
(+) is a logic operation among the possible from D3D12_LOGIC_OP entries (SBF) and (DBF) Source and Destination Blend Factors, two D3D12_BLEND enum values that will alter contribution of source and destination values for the final result.

(SC) and (DC) are Source and Destination Color (the first from pixel shader result and the second from the already existing value in render target)
STENCYL SHADERS CODE
I could not find the source code where this number comes from.// Create the vertex input layout D3D12_INPUT_ELEMENT_DESC inputLayout = $$ Here is a test Post Process material which, sort of, proves that: It turns out that CustomDepth node returns 100000000 cm rather than positive infinity when this feature is not enabled on an object. If Custom Depth Stencil value is 50, then the color is red. Now, it’s just a matter of two “if” statements to figure out which color a sphere needs to be. I also extended the material blueprint for the case when a mesh with Custom Depth feature is enabled – I check Custom Depth Stencil values as well too. I set Custom Depth Stencil value of 50 to the sphere on the left. By default, it returns 0 (zero) for all objects and a custom value manually set in Mesh settings. You may use it in order to distinguish objects in a scene. The other useful node is Custom Depth Stencil.

Of course, you will need to polish it before using in production, but at least it answers what Custom Depth is. See! We’ve got some sort of an occlusion masking. To distinguish the cases and for the sake of the experiment, we can compare Custom Depth to some arbitrary value which is lower than positive infinity but which is greater than a distance to any object in the scene.

NOTE: There is a small issue here: Case #2 is logically the same as Case #3 – in both cases, Scene Depth is less than Custom Depth. Custom depth returns positive infinity and Scene Depth returns an actual distance to such objects.

The official documentation gives a vague description of these nodes which does not really help (I have already discussed the quality of the official documentation here: ) Custom Depth And I don’t mean how the shader itself works, but rather what kind of values these nodes return. Tom Looman’s tutorials are pretty good too: īut what I did not find and had to figure out on my own is how exactly Custom Depth and Custom Depth Stencil work.
