Topic has a solution and is locked
Log in or register to post comments

Issue Depth Mask Shader don't work in AR Unity3D

September 16, 2016 - 1:38am #1
Topic solved

hi :)

I'm trying to create a scene in unity3D with Vuforia AR but i have a issue.

I need to create a mask in a plane (in this plane object i will need to see the real world) and i use DepthMask shader but when i use, i only see black color... If i change the clear flags in "Depth only" in the plane i see an strange transparent.

Thanks.

Issue Depth Mask Shader don't work in AR Unity3D

May 16, 2019 - 12:30pm #17

I did it and still have the Issue :/

Issue Depth Mask Shader don't work in AR Unity3D

May 13, 2019 - 5:39am #16

Moreover, It's necessary to disable "Auto Graphics API" and change the Graphics API to only GLES2 (and removing GLES3) - as seen in the screenshot below

AttachmentSize
Image icon gles2.PNG14.46 KB

Issue Depth Mask Shader don't work in AR Unity3D

May 10, 2019 - 10:02am #15

Hi, Vuforia Team, I was also facing same problem. After wasting few hours gonna frustrate. and come to this post and change Depth Shader from "ZTest LEqual" to "ZTest Always". One request, please do change same in your SDK. Thanks

Issue Depth Mask Shader don't work in AR Unity3D

May 7, 2019 - 11:31pm #14

So like bajablasted I found the "ZTest Always" fix didn't work and showed objects that should have been occluded. I replaced the default DepthMask.shader with the script here and then changed the queue position and now have perfect occlusion on all platforms. 

 

Shader "DepthMask" {
    SubShader {
        Tags { "RenderType"="Opaque" "Queue"="Geometry-1"}
        colormask 0
        Pass {
            Stencil {
                Ref 2
                Comp Greater
                Pass Replace
            }
    
            CGPROGRAM
            #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);
            }
            ENDCG
        }
    }
}

Issue Depth Mask Shader don't work in AR Unity3D

November 15, 2017 - 1:59pm #13

This solution does NOT work correctly. It still shows parts of objects that are supposed to be occluded. All of our devices with Android 7.0 or higher have this issue. 

 

Edit: In the attached file, you can see the two cubes that are showing are supposed to be hidden by the depth mask but obviously show. 

AttachmentSize
Image icon Screenshot_20171115-155232.png2.12 MB

Issue Depth Mask Shader don't work in AR Unity3D

October 22, 2017 - 7:28pm #12

Same issue on LG G5 Android 7. It looks fine in Unity but when I build it on the phone the result is a strangely pixelated black area where it should be occluded.

Issue Depth Mask Shader don't work in AR Unity3D

May 25, 2017 - 12:22pm #11

Fantastic, found that the Black pixels of doom showed up only on a Sony Xperia X. Solution worked perfectly.



1:  Open this file: Assets/Vuforia/Shaders/DepthMask.shader

2:  Change "ZTest LEqual" to "ZTest Always"



:D

Issue Depth Mask Shader don't work in AR Unity3D

January 9, 2017 - 6:51pm #10

Try this:


  1. Open this file: Assets/Vuforia/Shaders/DepthMask.shader
  2. Change "ZTest LEqual" to "ZTest Always"


Issue Depth Mask Shader don't work in AR Unity3D

January 3, 2017 - 12:49pm #9

Hello,

I was able to reproduce on a Pixel XL (7.1.1) with Vuforia 6.2.6 Unity Extension and Unity 5.3.6/5.5.0 using the cylinders sample. I have opened a ticket for further investigation and will update this thread if any additional details become available.

Thanks

Issue Depth Mask Shader don't work in AR Unity3D

December 19, 2016 - 5:01am #8

Same issue in Xiaomi Redmi Note 3. objects behind Masked objects turn pixlated black . Please reply on it

Issue Depth Mask Shader don't work in AR Unity3D

December 14, 2016 - 11:17am #7

Same issue testing with the CylinderTarget sample scene on a Pixel XL.  Latest 7.1.1 Android build.  The orbiting sphere turns into a pixelated black circle when it should be masked out.  Can someone from Vuforia please comment on this?  Even if the answer is that it is unfixable at this time, that would allow us to move on.  Thank you

Issue Depth Mask Shader don't work in AR Unity3D

December 14, 2016 - 9:36am #6

We also are having the same issue, ios its fine. but in android it show black silhouette. Im testing on GalaxyS7,  6.0.1 android version and 3.18.20 kernel version.

Any one got this working?  

Issue Depth Mask Shader don't work in AR Unity3D

December 1, 2016 - 3:00am #5

We are seeing the same issue. On some devices (mainly US iterations of Samsung devices) the depth mask shader does not work, but on European versions its fine. Any idea why this would be the case?

Issue Depth Mask Shader don't work in AR Unity3D

November 10, 2016 - 3:12pm #4

I also have this issue, samsung Galaxy Tab S2. The object with the depthmask applied has a black pixelated wireframe appearance.

It works on an older S2 though, which has a different android kernel version (3.10.9-83374498) versus the newer one that doesnt work (3.18.84-7767647).

Is there at least a workaround for this??

Issue Depth Mask Shader don't work in AR Unity3D

October 29, 2016 - 5:43pm #3

I'm seeing this as well. Working fine on an Android Galaxy S3 and S5, but I see a black, pixelated silhouette of the supposedly masked objects in the S7. 

Issue Depth Mask Shader don't work in AR Unity3D

October 16, 2016 - 10:10pm #2

same issue here, it works fine with some devices and does not work with my Mi device.

 

Log in or register to post comments