unity_StereoEyeIndex is always 1 on single pass instanced for rift-s

EDIT: Hi guys i was trying to get eyeIndex like below in my custom function which is called inside frag shader. But as said it did not work. But when i get the unity_StereoEyeIndex in vertex shader and put it in a custom variable, then use it on frag shader everything worked ok :slight_smile: So if you have that strange behaviour too; get the eyeIndex on vertex shader and pass it to frag via custom param (like “float myEyeIndex” etc) and use it like that.

Hi,
I am getting the unity_StereoEyeIndex always 1 on single pass instanced mode for rift-s for standard pipeline for Unity 2019.3.0f3. Is anyone getting the same issue? Or am i doing something wrong

float eyeIndex = 0;
#if defined(UNITY_STEREO_INSTANCING_ENABLED)

eyeIndex = unity_StereoEyeIndex; //code falls here!!!

#elif defined(UNITY_SINGLE_PASS_STEREO)

eyeIndex = unity_StereoEyeIndex;

#else

#endif

1 Like

Did you put your custom variable for the unity_StereoEyeIndex in a struct that you pass from your vertex shader to your fragment shader? If so, what semantic did you use?

You can use TEXCOORD0 for such values. If that’s already taken, use TEXCOORD with another index.