Log in or register to post comments

Depth Mask Showing Black Pixels of Hidden Objects

November 15, 2017 - 2:05pm #1



It seems as though vuforia closed the previous thread that said this was solved and it isn't. The previous fix was to turn the ZTest to Always which works.... kind of. The objects are no longer black and pixelated and are hidden, but other objects that are supposed to be hidden show through. See the file attachment for a reference. If the ZTest is changed back to LEqual we see  the black pixel rendering through the depth mask. 

Image icon Screenshot_20171115-155232.png2.12 MB

Depth Mask Showing Black Pixels of Hidden Objects

May 7, 2019 - 11:35pm #3

I've added the solution I have that works at the previous post. Will add it here for posterity...

You can either replace the DepthMask.shader contents, or (if worried about updates overwriting it) add your own CustomDepthMask.shader and then change the DepthMask material in the Vuforia materials to utilise CustomDepthMask as its shader

Shader "DepthMask" {
    SubShader {
        Tags { "RenderType"="Opaque" "Queue"="Geometry-1"}
        colormask 0
        Pass {
            Stencil {
                Ref 2
                Comp Greater
                Pass Replace
            #pragma vertex vert
            #pragma fragment frag
            struct appdata {
                float4 vertex : POSITION;
            struct v2f {
                float4 pos : SV_POSITION;
            v2f vert(appdata v) {
                v2f o;
                o.pos = UnityObjectToClipPos(v.vertex);
                return o;
            half4 frag(v2f i) : SV_Target {
                return half4(1,0,0,1);

Depth Mask Showing Black Pixels of Hidden Objects

February 22, 2019 - 1:59pm #2


Just bumping this thread as this problem still exists, 15 months later in Feb. 2019, with Vuforia 8.0.10 and Unity 2018.2.18f1.

We've got an upset client and absolutely no leads on fixing this, and the ZTest to Always behavior (described perfectly by the previous poster) also won't cut it.

Any help with this issue would be super appreciated!

Log in or register to post comments