Is CustomStencil broken?

Edit: Found the issue. I needed to enable stencils in the project settings. Go to Project Settings > Rendering > Post Process > Custom Depth-stencil Pass and set it to Enabled with Stencil. Found thanks to Multi-color Outline Post Process - Tom Looman

I was following a guide on CustomDepth and CustomStencil to learn how they work, but CustomStencil doesn’t seem to work correctly. I have a partially occluded test object with custom depth enabled and a non-zero stencil value:

image

CustomDepth is working since I was able to visualize the occlusion. However, CustomStencil doesn’t seem to be working and seems to output 0 for the whole scene, which I validated using this test material:

The output is the same regardless of the value of the custom depth stencil and the stencil write mask. Am I doing something wrong here, or is CustomStencil broken?

You have to enable the stencil mask in the settings, either in the project or editor.