For a both-eye camera and with single-pass stereo off, WorldSpaceViewDir returns the exact same vector. This results in specular/gloss not being correctly stereoscopic. All surface shaders appear to use this function when passing viewDir to the lighting function.
In UnityCG.cginc this function is defined this way:
inline float3 UnityWorldSpaceViewDir( in float3 worldPos )
{
return _WorldSpaceCameraPos.xyz - worldPos;
}
I have found it can be fixed by using the unity_CameraToWorld matrix as follows:
inline float3 UnityWorldSpaceViewDir( in float3 worldPos )
{
float3 wpos;
wpos.x = unity_CameraToWorld[0][3];
wpos.y = unity_CameraToWorld[1][3];
wpos.z = unity_CameraToWorld[2][3];
return wpos - worldPos;
}
It is kind of a pain to override UnityCG.cginc, so I’m hoping there will be an official fix for this. I haven’t been able to move to single-pass stereo due to poorer performance and also broken effects.
ccs