qxxxb Posted August 26, 2020 Posted August 26, 2020 I'm trying to calculate the point of convergence by using the gaze rays from the left and right eyes. This is what my script currently looks like: Vector3 LeftGazeOrigin = LeftGazeOriginLocal + Camera.main.transform.position; Vector3 RightGazeOrigin = RightGazeOriginLocal + Camera.main.transform.position; Vector3 LeftGazeDir = Camera.main.transform.TransformDirection(LeftGazeDirLocal); Vector3 RightGazeDir = Camera.main.transform.TransformDirection(RightGazeDirLocal); // Create a gaze plane using three points: // - The left gaze origin // - The right gaze origin // - The midpoint of the gaze origins + the combined (average) gaze // direction Vector3 CombinedGazeDir = (LeftGazeDir + RightGazeDir) / 2; Vector3 MidpointGazeOrigin = (LeftGazeOrigin + RightGazeOrigin) / 2; Vector3 ThirdPoint = MidpointGazeOrigin + CombinedGazeDir; Plane GazePlane = new Plane(RightGazeOrigin, LeftGazeOrigin, ThirdPoint); // Project gaze directions onto the gaze plane. We do this to ensure // that the projected rays will intersect. Vector3 ProjLeftGazeDir = Vector3.ProjectOnPlane(LeftGazeDir, GazePlane.normal); Vector3 ProjRightGazeDir = Vector3.ProjectOnPlane(RightGazeDir, GazePlane.normal); ProjLeftGazeDir.Normalize(); ProjRightGazeDir.Normalize(); // Calculate the intersection of the projected left and right gaze // rays. To do this, we create a plane orthogonal to the gaze plane which // contains the left gaze ray. We then use Unity's `Raycast` function to find // the intersection of this plane and the right gaze ray. Vector3 LeftGazePlaneNormal = Vector3.Cross(GazePlane.normal, ProjLeftGazeDir); LeftGazePlaneNormal.Normalize(); Plane LeftGazePlane = new Plane(LeftGazePlaneNormal, LeftGazeOrigin); Ray RightGazeRay = new Ray(RightGazeOrigin, ProjRightGazeDir); float Enter = 0.0f; if (LeftGazePlane.Raycast(RightGazeRay, out Enter)) { Vector3 Intersection = RightGazeRay.GetPoint(Enter); } After this testing out this script on Unity, it seemed to be working. However, the calculated point of convergence seemed to vary considerably even during fixation. Because of this, I was wondering if anyone had suggestions to improve this script or if anyone had alternative approaches to calculate point of convergence. A common alternative approach I've seen is to create a single combined gaze ray by averaging the left and right gaze origins and directions. The combined gaze ray would then be raycasted to find collisions with other game objects. However, I would prefer a solution which only uses data from the left and right eyes to find the point of convergence. 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now