Custom Pass for Card Interiors

This has been vexing me for ages. Im in HDRP Unity 6 Preview and i’m trying to make objects render inside card windows only.

the card window has the following shader applied:

Shader "Custom/CardWindow"
{
    SubShader
    {
        Pass
        {
            ColorMask 0
            Zwrite Off

            Stencil
            {
                Ref 2
                Comp Always
                Pass Replace
            }
        }
    }    
}

I was told that Custom Passes are the way to go, I have set up a seperate layer for objects called CardInterior, but I’m having trouble finding the correct settings to make the cube appear only inside the card window:


Theres so many settings, does anyone know how I would get this working?

Thanks in advance for any help.

Not sure about the custom pass stuff. But it looks like you’re using the stencil buffer, which is how I would do this. You will need to modify the shader that draws the stuff inside the card window, like the cube, to check & respect the stencil. If I remember correctly, originally stencil stuff was not available for HDRP, but looks like it is now (at least a couple of bits): Stencil Buffer Usage in HDRP | High Definition RP | 17.0.3

thanks but unless you know how to modify generated shader graph code to apply to that stencil I can’t do it the shader code way

thats why im trying to do it with the volume, because the original tutorial used a Render Feature (in URP), which I was told was Custom Passes volume in HDRP

all he did was select objects and apply them to the correct layer and the render feature would do the rest…