Possible to detect which VR eye in shader?

Is it possible to detect which VR eye is being drawn for in a shader?

I’ve figured out a workaround. For anyone else looking for something like this, I’ve scoured the 5.4 docs, and I don’t think there’s anything explicitly for this purpose. But since the projection matrix is different for each eye, you can do this:

if (unity_CameraProjection[0][2] < 0) {
    o.Emission = tex2D(_LeftEyeTexture, screenUV).rgb;
} else {
    o.Emission = tex2D(_RightEyeTexture, screenUV).rgb;
}
1 Like