Now that the stencil option for the custom pass feature in HDRP is now exposed.
I tried making a cutout effect with it but it seems I’m missing something or maybe it’s a bug?
I did basically the same thing in URP and it worked fine but maybe HDRP requires more.
The Setup
I made two Layer Masks
- Stencil Mask - Object that will do the masking
- Stencil Show - Object that will be affected by the masks.
Applied the correct Layer Mask to each object
- Sphere - Stencil Mask
- Cube - Stencil Show
Created a Stencil Shader
Created a Custom Pass Volume
Added two Draw Renders Pass
- One for the masking object
- Another for the objects that will show the mask
- Setup the Stencil options
Created a material from the Stencil Shader
Added it to the material slot for the Stencil Mask Custom Render Pass
Result
What I’m trying to achieve