Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We’re making changes to the Unity Runtime Fee pricing policy that we announced on September 12th. Access our latest thread for more information!
    Dismiss Notice
  3. Dismiss Notice

Custom Pass - Stencil Masking

Discussion in '2022.2 Beta' started by Grimreaper358, May 13, 2022.

  1. Grimreaper358


    Apr 8, 2013
    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



    What I'm trying to achieve

  2. Sisay


    Dec 6, 2012
    some progress?