Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Depth Mask problem

Discussion in 'VR' started by millefoliumink, Oct 22, 2018.

  1. millefoliumink

    millefoliumink

    Joined:
    Aug 28, 2014
    Posts:
    139
    I'm trying to figure out how to use a depth mask with the Google VR SDK,
    at the moment I'm getting this funky outcome which is not what's meant to happen.

    https://imgur.com/a/L6p7aVn

    The shader I am using is the one below with a Set Render queue script on GameObjects I'm punching holes through, everything works fine in the editor but appears messed up when testing on the Google Pixel 2

    Code (CSharp):
    1. Shader "Masked/Mask" {
    2.     SubShader {
    3.         // Render the mask after regular geometry, but before masked geometry and
    4.         // transparent things.
    5.        
    6.         Tags {"Queue" = "Geometry-10" }
    7.         // Don't draw in the RGBA channels; just the depth buffer
    8.  
    9.         Lighting Off
    10.  
    11.         ZTest LEqual // added this
    12.         ZWrite On
    13.  
    14.         ColorMask 0
    15.         // Do nothing specific in the pass:
    16.         Pass {}
    17.     }
    18. }
    Additional info:
    Unity 2017.4.12f1
    GoogleVRForUnity_1.170.0
    Using 32-bit Display Buffer
    Color Space: Gamma
    Graphics APIs:
    -OpenGLES3
    -OpenGLES2
    Depth Format: 16-bit depth
     
  2. ArshakKroyan

    ArshakKroyan

    Joined:
    Mar 4, 2015
    Posts:
    34