Search Unity

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

Discussion in 'AR/VR (XR) Discussion' started by AkilliMum, Jan 16, 2020.

  1. AkilliMum

    AkilliMum

    Joined:
    Dec 6, 2014
    Posts:
    111
    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 :) 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
     
    Last edited: Feb 19, 2020
    Mese96 likes this.
  2. magdalenajones

    magdalenajones

    Joined:
    Sep 12, 2023
    Posts:
    2
    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?
     
  3. KayH

    KayH

    Joined:
    Jan 6, 2017
    Posts:
    110
    You can use TEXCOORD0 for such values. If that's already taken, use TEXCOORD with another index.