Hey all, Just a simple question here. I was looking at Unity's Sprite shader source and came across these macros: UNITY_VERTEX_OUTPUT_STEREO UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT); I can't seem to find out what these are for. Just wondering what they do. Is it related to Stereoscopy? I can't seem to see any difference if I remove those lines of code... and I don't really want stuff using up resources if I don't need it.
It's related to VR, specifically single pass stereo rendering for VR. They do nothing if VR is not enabled.
@bgolus : I use this for VR, but I am unable to find any documentation on what these macros do. Will you be able to shed some light on that?
They pass the instance id and eye index to the fragment shader. This lets you access instanced properties in the fragment shader, as well as do any unique per eye work that may be needed. For example, if you’re using any of the view or projection matrices or the camera position in the fragment shader these need the eye index to give the correct value, otherwise you’ll always access the left eye. edit: You have to additionally call UNITY_TRANSFER_INSTANCE_ID to transfer the instance id.