Search Unity

Windows MXR Single Eye Render Problem

Discussion in 'VR' started by DanBHas, Mar 2, 2020.

  1. DanBHas

    DanBHas

    Joined:
    Mar 2, 2020
    Posts:
    5
    I just started using Unity 2019.3.3f1 with the new XR Plugin Manager. I have a Samsung Mixed Reality Headset that I am developing on and can only get the scene to render in the left eye.

    I am using the Universal Render Pipeline and have upgraded all the shaders to the Universal Render Pipeline/Lit version. I also created some new objects with a new material with the same shader, and that does not render in the right eye either.

    The only options I have under the Project Settings for the Mixed Reality is the Depth Buffer and shared Depth Buffer. I cannot change from Single Pass to Multi Pass. I believe it defaults to Single Pass.

    Is there a setting I am missing or something I need to set in code?
     
  2. ThomasZeng

    ThomasZeng

    Unity Technologies

    Joined:
    Jun 24, 2019
    Posts:
    85
  3. DanBHas

    DanBHas

    Joined:
    Mar 2, 2020
    Posts:
    5
    Hi Thomas, Yes all the macros are included in the LitForwardPass.hlsl, except for UNITY_INITIALIZE_OUTPUT. This is the default URP Lit shader.

    Is there a reason that it would not be using forward pass? This is the section of the shader that the included HLSL is in.
     
  4. DanBHas

    DanBHas

    Joined:
    Mar 2, 2020
    Posts:
    5
    I've tried the debugging shader in the link you gave me and still no right eye.

    Also I am using XR Manager 3.0.6 and Windows XR Plugin 2.0.4 preview.3

    Code (CSharp):
    1. Shader "XR/StereoEyeIndexColor"
    2. {
    3.    Properties
    4.    {
    5.        _LeftEyeColor("Left Eye Color", COLOR) = (0,1,0,1)
    6.        _RightEyeColor("Right Eye Color", COLOR) = (1,0,0,1)
    7.    }
    8.  
    9.    SubShader
    10.    {
    11.       Tags { "RenderType" = "Opaque" }
    12.  
    13.       Pass
    14.       {
    15.          CGPROGRAM
    16.  
    17.          #pragma vertex vert
    18.          #pragma fragment frag
    19.  
    20.          float4 _LeftEyeColor;
    21.          float4 _RightEyeColor;
    22.  
    23.          #include "UnityCG.cginc"
    24.  
    25.          struct appdata
    26.          {
    27.             float4 vertex : POSITION;
    28.  
    29.             UNITY_VERTEX_INPUT_INSTANCE_ID
    30.          };
    31.  
    32.          struct v2f
    33.          {
    34.             float4 vertex : SV_POSITION;
    35.  
    36.             UNITY_VERTEX_INPUT_INSTANCE_ID
    37.             UNITY_VERTEX_OUTPUT_STEREO
    38.          };
    39.  
    40.          v2f vert (appdata v)
    41.          {
    42.             v2f o;
    43.  
    44.             UNITY_SETUP_INSTANCE_ID(v);
    45.             UNITY_INITIALIZE_OUTPUT(v2f, o);
    46.             UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
    47.  
    48.             o.vertex = UnityObjectToClipPos(v.vertex);
    49.  
    50.             return o;
    51.          }
    52.  
    53.          fixed4 frag (v2f i) : SV_Target
    54.          {
    55.             UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i);
    56.  
    57.             return lerp(_LeftEyeColor, _RightEyeColor, unity_StereoEyeIndex);
    58.          }
    59.          ENDCG
    60.       }
    61.    }
    62. }
     
    Reahreic, CloudyVR and P_Jong like this.
  5. ThomasZeng

    ThomasZeng

    Unity Technologies

    Joined:
    Jun 24, 2019
    Posts:
    85
    Hi @DanBHas

    Thanks for getting back to me.
    The shader code you posted looks fine besides not using URP shader include. May I ask which URP version you are using?
    If you are using URP 7.2.1, then please submit a bug and I will take a look as soon as I can.

    Thanks
    Thomas
     
  6. DanBHas

    DanBHas

    Joined:
    Mar 2, 2020
    Posts:
    5
    I was using 7.2.1, and I just tried 7.1.8 as well, but nether worked. It seems like the Standard renderer doesn't work with this XR system.
     
  7. DanBHas

    DanBHas

    Joined:
    Mar 2, 2020
    Posts:
    5
    I just tried going back to the old VR system under player settings and I have a similar problem with the URP. This time the right eye is black instead of showing the background color of the camera.

    I'm back to the built-in renderer with the old VR system and everything works fine there.

    I'll submit this as a bug, but I haven't seen anyone else with this problem on the Windows Mixed Reality that couldn't solve it.
     
  8. foonix

    foonix

    Joined:
    Dec 15, 2019
    Posts:
    20
    I'm having the same problem with HDRP+XRSDK. In single pass mode, all non-HDRP shaders (including unity built in like UI/Default) only render in left eye. HDRP shaders like HDRP/Lit and Unlit work fine. ShaderGraph based shaders that use lit or unlit output nodes work fine.

    Also for some reason the headset is way darker than the screen mirror. Samsung Odyssey HMD (not plus).

    2019.3.5, SRP 7.2.1, all of the latest XR related packages in the package manager. Tried with stable and preview packages.
     
  9. mplavcan_vrmc

    mplavcan_vrmc

    Joined:
    Apr 18, 2018
    Posts:
    2
    I'm seeing a similar issue, using the Built-in RP.
    2019.3.9f1
    Windows Plugin 2.0.3
    XR Plugin Management 3.2.6

    In my case, I've a custom Transparent shader applied to a sphere around the camera to create fade-in/out. Only the left eye is affected by the fade out.

    Is it possible this is a flavor of issue 1225548?
     
    P_Jong likes this.
  10. MotionDetection

    MotionDetection

    Joined:
    Jul 14, 2020
    Posts:
    1
    My system is only rendering the left eye as well. Samsung Odyssey +, unity 2019.4.1f1 with XR plugin.
     
  11. Extrys

    Extrys

    Joined:
    Oct 25, 2017
    Posts:
    345
    Were you able to solve it, we are experiencing the same problem, without changing anything one day it started this problem, and even going back in the repository history we can get this bug fixed
     
  12. foonix

    foonix

    Joined:
    Dec 15, 2019
    Posts:
    20
    The "left eye" problems I was having at that time were eventually fixed by various updates to unity and HDRP. Sorry I can't remember which version exactly. We're on unity 2022.1 branch and HDRP 13.1.8.

    The "dark headset" problem wasn't fixed until we switched from WindowsMR/Oculus packages to OpenXR.

    If the problem happened suddenly, consider blowing away the `Library` directory and do a full reimport. Some of my cohorts have recently had signs of incompatible shaders getting "stuck" in their build cache. IIRC, the left eye problem had to do with shaders not looking in the right place for the right-eye matrix created by HDRP.
     
  13. Extrys

    Extrys

    Joined:
    Oct 25, 2017
    Posts:
    345

    We were able to fix our problem by going to ProjectSettings > GraphicsSettings

    and the field where the SRP asset should be (the first field) appeared as "None" although we were using the SRP without problems, we just put the SRP in there and nothing changes because internally stills assigned or something like that
    but then after restarting Unity after doing that, everything started working correctly, and legacy shaders were visible with the 2 eyes again