Jump to content

Vive Pro Eye Unity OpenXR Eyetracking slightly off. Any Ideas?


Recommended Posts

Hi,

I implemented the eyetracking in Unity like it is proposed in the Vive Tutorial (https://developer.vive.com/resources/openxr/openxr-pcvr/tutorials/unity/integrate-facial-tracking-your-avatar/). The eye tracking works in principle but it is slightly off.

It gravitates to the left. Any ideas why this happens?

 

I used this code to get the lookat position:

if (NeededToGetData)
                {
                    facialManager.GetWeightings(out EyeWeightings);
                    
                    Vector3 LeftEye = Vector3.zero;


                    Vector3 RightEye = Vector3.zero;
                    Vector3 GazeDirectionCombinedLocal = Vector3.zero;
                    if (EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_LEFT_IN_HTC] > EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_LEFT_OUT_HTC])
                    {
                        GazeDirectionCombinedLocal.x = EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_LEFT_IN_HTC];
                    }
                    else
                    {
                        GazeDirectionCombinedLocal.x = -EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_LEFT_OUT_HTC];
                    }
                    if (EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_LEFT_UP_HTC] > EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_LEFT_WIDE_HTC])
                    {
                        GazeDirectionCombinedLocal.y = -EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_LEFT_UP_HTC];
                    }
                    else
                    {
                        GazeDirectionCombinedLocal.y = EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_LEFT_WIDE_HTC];
                    }
                    GazeDirectionCombinedLocal.z = (float)1.0;
                    LeftEye = Quaternion.Euler(cam.transform.localEulerAngles) * GazeDirectionCombinedLocal;

                    if (EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_RIGHT_IN_HTC] > EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_RIGHT_UP_HTC])
                    {
                        GazeDirectionCombinedLocal.x = -EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_RIGHT_IN_HTC];
                    }
                    else
                    {
                        GazeDirectionCombinedLocal.x = EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_RIGHT_UP_HTC];
                    }
                    if (EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_RIGHT_UP_HTC] > EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_RIGHT_DOWN_HTC])
                    {
                        GazeDirectionCombinedLocal.y = EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_RIGHT_UP_HTC];
                    }
                    else
                    {
                        GazeDirectionCombinedLocal.y = -EyeWeightings[XrEyeShapeHTC.XR_EYE_EXPRESSION_RIGHT_DOWN_HTC];
                    }
                    GazeDirectionCombinedLocal.z = (float)1.0;
                    RightEye = Quaternion.Euler(cam.transform.localEulerAngles) * GazeDirectionCombinedLocal;
                    Debug.Log($"Left x {LeftEye.x} Right x {RightEye.x} diff = {LeftEye.x - RightEye.x} __ LeftEye ? Right {Mathf.Approximately(LeftEye.x, RightEye.x) },{Mathf.Approximately(LeftEye.y, RightEye.y)}, {Mathf.Approximately(LeftEye.z, RightEye.z)}");
                    lookAtDir = (LeftEye + RightEye) / 2;

Link to comment
Share on other sites

  • 4 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...