cancel
Showing results for 
Search instead for 
Did you mean: 

OVRCameraRig use per eye cameras changes scale

bANGERnomics
Level 2
I'm working on a 3D image/video solution so I'm using the 'per eye camera' option in the OVR Camera Rig in Unity.  I noticed that if I toggle this setting on and off, the scale of the world is radically affected.  With the per eye camera setting off, the eye separation appears correct, but when I switch it on, it seems to jump.  I don't seem to have any control over this and so it is completely breaking my project.  I'm using Unity 2019.3.2.f1 on OVR 1.42.0.  This issue occurs when using Oculus Link on the quest from the editor and also in the Quest build.
6 REPLIES 6

bANGERnomics
Level 2
I've done some more digging and it looks like the eye separation is in line with the user setting on the headset.  I'm now suspecting the FOV as a possible source.  I tried a completely separate project and found the same issue (toggling the per eye camera setting in the OVR Camera Rig changes the perception of scale).  I noticed that the hand tracking is correctly aligned with my real-world hand when using the single camera, but when per eye cameras are enabled, my real-world hand moved much further than my virtual hand.

phileday
Level 5
This still appears to be a problem with the latest Unity 2020.2.1f1 and the latest Oculus SDK.

It's pretty easy to recreate as well. use a prefab Oculus camera rig, add a cube to one of the controllers, run, looks fine. Tick on Camera per eye and it's wrong (smaller).

I'm also looking into solutions 🙂

phileday
Level 5
Update:

So I've found a fix, in OVRCameraRig.cs I changed 

if (!hmdPresent || monoscopic)
{
leftEyeAnchor.localPosition = centerEyeAnchor.localPosition;
rightEyeAnchor.localPosition = centerEyeAnchor.localPosition;
leftEyeAnchor.localRotation = centerEyeAnchor.localRotation;
rightEyeAnchor.localRotation = centerEyeAnchor.localRotation;
}
else
{
                leftEyeAnchor.localPosition = centerEyeAnchor.localPosition;
                rightEyeAnchor.localPosition = centerEyeAnchor.localPosition;
                leftEyeAnchor.localRotation = centerEyeAnchor.localRotation;
                rightEyeAnchor.localRotation = centerEyeAnchor.localRotation;

Vector3 leftEyePosition = Vector3.zero;
Vector3 rightEyePosition = Vector3.zero;
Quaternion leftEyeRotation = Quaternion.identity;
Quaternion rightEyeRotation = Quaternion.identity;

if (OVRNodeStateProperties.GetNodeStatePropertyVector3(Node.LeftEye, NodeStatePropertyType.Position, OVRPlugin.Node.EyeLeft, OVRPlugin.Step.Render, out leftEyePosition))
leftEyeAnchor.localPosition = leftEyePosition;
if (OVRNodeStateProperties.GetNodeStatePropertyVector3(Node.RightEye, NodeStatePropertyType.Position, OVRPlugin.Node.EyeRight, OVRPlugin.Step.Render, out rightEyePosition))
rightEyeAnchor.localPosition = rightEyePosition;
if (OVRNodeStateProperties.GetNodeStatePropertyQuaternion(Node.LeftEye, NodeStatePropertyType.Orientation, OVRPlugin.Node.EyeLeft, OVRPlugin.Step.Render, out leftEyeRotation))
leftEyeAnchor.localRotation = leftEyeRotation;
if (OVRNodeStateProperties.GetNodeStatePropertyQuaternion(Node.RightEye, NodeStatePropertyType.Orientation, OVRPlugin.Node.EyeRight, OVRPlugin.Step.Render, out rightEyeRotation))
rightEyeAnchor.localRotation = rightEyeRotation;
}
}

to this:

if (!hmdPresent || monoscopic)
{
leftEyeAnchor.localPosition = centerEyeAnchor.localPosition;
rightEyeAnchor.localPosition = centerEyeAnchor.localPosition;
leftEyeAnchor.localRotation = centerEyeAnchor.localRotation;
rightEyeAnchor.localRotation = centerEyeAnchor.localRotation;
}
else
{
                leftEyeAnchor.localPosition = centerEyeAnchor.localPosition;
                rightEyeAnchor.localPosition = centerEyeAnchor.localPosition;
                leftEyeAnchor.localRotation = centerEyeAnchor.localRotation;
                rightEyeAnchor.localRotation = centerEyeAnchor.localRotation;

/*
Vector3 leftEyePosition = Vector3.zero;
Vector3 rightEyePosition = Vector3.zero;
Quaternion leftEyeRotation = Quaternion.identity;
Quaternion rightEyeRotation = Quaternion.identity;

if (OVRNodeStateProperties.GetNodeStatePropertyVector3(Node.LeftEye, NodeStatePropertyType.Position, OVRPlugin.Node.EyeLeft, OVRPlugin.Step.Render, out leftEyePosition))
leftEyeAnchor.localPosition = leftEyePosition;
if (OVRNodeStateProperties.GetNodeStatePropertyVector3(Node.RightEye, NodeStatePropertyType.Position, OVRPlugin.Node.EyeRight, OVRPlugin.Step.Render, out rightEyePosition))
rightEyeAnchor.localPosition = rightEyePosition;
if (OVRNodeStateProperties.GetNodeStatePropertyQuaternion(Node.LeftEye, NodeStatePropertyType.Orientation, OVRPlugin.Node.EyeLeft, OVRPlugin.Step.Render, out leftEyeRotation))
leftEyeAnchor.localRotation = leftEyeRotation;
if (OVRNodeStateProperties.GetNodeStatePropertyQuaternion(Node.RightEye, NodeStatePropertyType.Orientation, OVRPlugin.Node.EyeRight, OVRPlugin.Step.Render, out rightEyeRotation))
rightEyeAnchor.localRotation = rightEyeRotation;
*/
}
}

basically making the left and right camera do this

leftEyeAnchor.localPosition = centerEyeAnchor.localPosition;
rightEyeAnchor.localPosition = centerEyeAnchor.localPosition;
leftEyeAnchor.localRotation = centerEyeAnchor.localRotation;
rightEyeAnchor.localRotation = centerEyeAnchor.localRotation;

seems to work 🙂

alexish007
Level 2

This was a bothering issue, thanks for the workaround! Works 🙂

Thanks for this workaround! It's a strange issue, still occurring in2020.3.30f1. 

Thanks a lot for sharing this!!

Ran into the same issue with XR on Oculus Quest (Unity 2020.3.26f1) and setting the TrackedPoseDriver for the LeftEyeAnchor and RightEyeAnchor to use Input Actions 'centerEyePosition' and 'centerEyeRotation' solved this.