Search Unity

Question Simple depth mask shader that works in VR?

Discussion in 'Shaders' started by VirtualDawn, Aug 8, 2020.

  1. VirtualDawn

    VirtualDawn

    Joined:
    Sep 15, 2014
    Posts:
    31
    Hey,

    I've been looking through the net trying to find out what's wrong with my super simple shader that's just supposed to show the skybox through any object. Works fine without VR, but smears like below in VR.

    I'm using unity 2019.4.7f1 and standard pipeline and project is for Vive(but also Quest later on, maybe).

    Here's the shader:

    Shader "Masked/Mask" {

    SubShader
    {
    Tags {"Queue" = "Geometry-1" }

    Lighting Off

    Pass
    {
    ZWrite On
    ZTest LEqual
    ColorMask 0
    }
    }
    }
     
  2. VirtualDawn

    VirtualDawn

    Joined:
    Sep 15, 2014
    Posts:
    31
    I managed to circumvent the problem by making the depth mask be at queue level over 2500, rather than 1999.
    This works for me because I only have few objects behind the mask and can change their render queues to be higher than 2501 for geometry, but it's not a great solution.

    I'd be grateful if someone can tell me what the problem is with VR, depth mask and render queues under 2500(AlphaTest+50), since that is when the smear-effect starts.
     
    Last edited: Aug 8, 2020
    ABB13 likes this.