Depth Mask shader

Hello, I’d like to use a depthmask shader to hide objects and create virtual windows.
ShaderLab code is pretty straightforward:

Shader "Custom/DepthMaskVuforia"
{
    SubShader{
        // Render the mask after regular geometry, but before masked geometry and
        // transparent things.
        Tags {"Queue" = "Geometry+10" }
 
        // Don't draw in the RGBA channels; just the depth buffer
        ColorMask 0
        ZWrite On
 
        // Do nothing specific in the pass:
        Pass {}
    }
}

How to port this to the URP / VisionPro ??

There is a shader PolySpatial/Shaders/ARBasicOcclusion in PolySpatial package. You can use it for depth mask.

2 Likes

Thank you! I’ve missed that!

1 Like

Hello, i’ trying to achieve the same window effect that you mentionned.

Can you explain to me how to use the ARBasicOcclusion shader please, I think i’m missing something …

Thanks you very much for you help

Quads block virtual content thanks to ARBasicOcclusion shader as follows:

3 Likes

ibrahimpenekli diagram describes it well, it creates a mask of all the pixels behind it.

1 Like

Wonderful, thank you guys ! It’s very clear