shanks Posted August 31, 2020 Share Posted August 31, 2020 Hi @Cotta I have the same problem : unit_StereoEyeIndex is always 0 when I publish to the device,but effective on Unity Editor。 Below is my environment: Unity 2018.4.25 Wave SDK 3.1.94 Focus Plus This is my shader: Shader "Unlit/TestSinglepass" { Properties { _MainTex ("Texture", 2D) = "white" {} } SubShader { Tags { "RenderType"="Opaque" } LOD 100 Pass { CGPROGRAM #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" struct appdata { float4 vertex : POSITION; float2 uv : TEXCOORD0; }; struct v2f { float2 uv : TEXCOORD0; float4 vertex : SV_POSITION; UNITY_VERTEX_OUTPUT_STEREO }; sampler2D _MainTex; float4 _MainTex_ST; v2f vert (appdata v) { v2f o; UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv, _MainTex); return o; } fixed4 frag (v2f i) : SV_Target { UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); fixed4 col = fixed4(0, 0, 0, 1); if (unity_StereoEyeIndex == 0) { col = fixed4(1, 0, 0, 1); // Left:red } else { col = fixed4(0, 1, 0, 1); // Right:green } return col; } ENDCG } } } Thanks for help. @Tony PH Lin @Corvus Link to comment Share on other sites More sharing options...
GoranW Posted March 3, 2022 Share Posted March 3, 2022 Was this confirmed to work? I'm trying to get it working on VIVE Focus 3 using VIVE Input Utility (VIU). Same scene + shader is working on Quest 2 via Oculus XR in VIU, but if I switch to Wave XR in VIU then unit_StereoEyeIndex is always 0 (in frag shader), both for Single-pass and Multi-pass rendering.@Dario Any clue? Link to comment Share on other sites More sharing options...
GoranW Posted March 3, 2022 Share Posted March 3, 2022 (edited) OK, after some more testing I can conclude that with Wave XR, unit_StereoEyeIndex only works in vert shader but not in frag shader. This is in contrast to Oculus XR, where it works fine in frag shader as well. A workaround is to pass the value on from vert shader to frag shader. Edited March 3, 2022 by GoranW Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now