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. Dismiss Notice

Vuforia 7 depth mask is not working

Discussion in 'Vuforia' started by Gamrek, Jan 8, 2018.

  1. Gamrek

    Gamrek

    Joined:
    Sep 28, 2010
    Posts:
    164
    Hello,

    I am using the most basic image tracking for a project. And the depth mask is not working on my device, it is working fine in Editor. Please see the attached image, the object that I am using depth mask shows in black with white grid instead.

    Any idea how to fix that? Thanks in advance.

    Derek
     

    Attached Files:

  2. dpizzle

    dpizzle

    Joined:
    Feb 2, 2013
    Posts:
    31
    Try changing "ZTest LEqual" to "ZTest Always" in the shader.
     
    oliversitan likes this.
  3. Gamrek

    Gamrek

    Joined:
    Sep 28, 2010
    Posts:
    164
    That works. thanks very much
     
  4. swogdog

    swogdog

    Joined:
    Jan 7, 2013
    Posts:
    14
    I am also having this issue on Android. Changing the shader just makes the shader do nothing, it no longer masks anything. Any ideas?
     
    dmart331 likes this.
  5. dmart331

    dmart331

    Joined:
    Jan 21, 2017
    Posts:
    2
    I've been emailing about this and still don't have answers. Ztest always doesn't work. It shows the back face of the object you are trying to occlude.
     
    Last edited: Apr 10, 2018
    swogdog likes this.
  6. Encuadre

    Encuadre

    Joined:
    Sep 6, 2017
    Posts:
    1
    Hi! Is there some news about this issue?? My problem is with vuforia 7.2 unity 2018. Thanks
     
  7. neomarian

    neomarian

    Joined:
    May 11, 2012
    Posts:
    43
    Same problem here! And still no fix!
     
  8. oliversitan

    oliversitan

    Joined:
    May 16, 2017
    Posts:
    2
    it work to me, in Assets\Vuforia\Shaders\DepthMask.shader put this


    Code (CSharp):
    1. //===============================================================================
    2. //Copyright (c) 2015 PTC Inc. All Rights Reserved.
    3. //
    4. //Confidential and Proprietary - Protected under copyright and other laws.
    5. //Vuforia is a trademark of PTC Inc., registered in the United States and other
    6. //countries.
    7. //===============================================================================
    8. //===============================================================================
    9. //Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc.
    10. //All Rights Reserved.
    11. //Confidential and Proprietary - Qualcomm Connected Experiences, Inc.
    12. //===============================================================================
    13.  
    14. Shader "DepthMask" {
    15.  
    16.     SubShader {
    17.         // Render the mask after regular geometry, but before masked geometry and
    18.         // transparent things.
    19.      
    20.         Tags {"Queue" = "Geometry-10" }
    21.      
    22.         // Turn off lighting, because it's expensive and the thing is supposed to be
    23.         // invisible anyway.
    24.      
    25.         Lighting Off
    26.  
    27.         // Draw into the depth buffer in the usual way.  This is probably the default,
    28.         // but it doesn't hurt to be explicit.
    29.  
    30.         ZTest Always
    31.         ZWrite On
    32.  
    33.         // Don't draw anything into the RGBA channels. This is an undocumented
    34.         // argument to ColorMask which lets us avoid writing to anything except
    35.         // the depth buffer.
    36.  
    37.         ColorMask 0
    38.  
    39.         // Do nothing specific in the pass:
    40.  
    41.         Pass {}
    42.     }
    43. }
     
    cyanUNITY likes this.
  9. ThatMunk

    ThatMunk

    Joined:
    May 17, 2017
    Posts:
    12
    Setting graphics API to GLES2 may help
    gles2.PNG
     
  10. kasperigregori

    kasperigregori

    Joined:
    Sep 10, 2018
    Posts:
    1
    I am having this exact problem - and updating my shader did not seem to work. I am suspecting that my rendering settings are off somehow.