Eye Tracking¶
VIVE Wave™ XR plugin provides the Eye Tracking feature in the Wave XR Plugin and Essence packages (refer to Wave XR Plugin Packages).
By following this tutorial you can retrieve the tracking data of left, right and combined eyes. The Eye Tracking data contains:
- Gaze origin
- Gaze direction
- Eye openness
- Pupil diameter
- Pupil position
You can use the Eye Tracking data to implementing the Gaze feature. VIVE Wave™ XR plugin also provides two components of Eye Tracking Gaze in the Essence package.
After imported the Essence package you can use either of the two components.
Modify AndroidManifest.xml¶
To enable the Eye Tracking feature, you have to add below content to your AndroidManifest.xml.
<uses-feature android:name="wave.feature.eyetracking" android:required="true" />
InputDeviceEye¶
VIVE Wave™ XR plugin supports the UnityEngine.XR.Eyes interface and provides the InputDeviceEye class.
To use the InputDeviceEye class, you have to import the XRSDK package (refer to Wave XR Plugin Packages).
Refer to Unity XR InputDevice - Eye Tracking about the InputDeviceEye interface.
Eye Manager¶
Eye Manager is an enhanced class to provide the Eye Tracking data.
To use the EyeManager component, you have to import the Essence package (refer to Wave XR Plugin Packages) and add the EyeManager to your scene from the menu item.
Note
Enabling the Eye Tracking feature will consume additional power.
You can refer to Packages > VIVE Wave XR Plugin - Essence > Runtime > Scripts > EyeTracking > EyeManager.cs about the Eye Tracking Public API.
Here listed the Eye Tracking APIs. You can check the API reference in Wave Eye Tracking Interface.
using Wave.Essence.Eye;
// Enable Eye Tracking:
if (EyeManager.Instance != null) { EyeManager.Instance.EnableEyeTracking = true; }
// Eye Tracking Status:
public EyeTrackingStatus GetEyeTrackingStatus()
public bool IsEyeTrackingAvailable()
// Eye Origin/Direction:
public enum EyeType {
Combined = 0,
Right,
Left
}
public bool GetEyeOrigin(EyeType eye, out Vector3 origin)
public bool GetEyeDirectionNormalized(EyeType eye, out Vector3 direction)
// Combined Eye:
public bool GetCombinedEyeOrigin(out Vector3 origin)
public bool GetCombindedEyeDirectionNormalized(out Vector3 direction)
// Left Eye:
public bool GetLeftEyeOrigin(out Vector3 origin)
public bool GetLeftEyeDirectionNormalized(out Vector3 direction)
public bool GetLeftEyeOpenness(out float openness)
public bool GetLeftEyePupilDiameter(out float diameter)
public bool GetLeftEyePupilPositionInSensorArea(out Vector2 area)
// Right Eye:
public bool GetRightEyeOrigin(out Vector3 origin)
public bool GetRightEyeDirectionNormalized(out Vector3 direction)
public bool GetRightEyeOpenness(out float openness)
public bool GetRightEyePupilDiameter(out float diameter)
public bool GetRightEyePupilPositionInSensorArea(out Vector2 area)
Gaze Input Module¶
You can refer to Gaze Input about the usage of GazeInputModule.
For Eye Tracking, GazeInputModule provides additional options as below photo.
Eye Tracking
: Selects to use Eye Tracking data in GazeInputModule.
Eye
: Selects one of the Eye Tracking sources, Combined, Left or Right eye.
The GazeInputModule Eye Tracking depends on the EyeManager.
Gaze Raycast¶
Instead of using GazeInputModule, you can use GazeRaycastRing located at Packages > VIVE Wave XR Plugin - Essence > Runtime > Scripts > Raycast.
You can refer to Gaze Raycast Ring about the usage of GazeRaycastRing.
For Eye Tracking, GazeRaycastRing provides additional options as below photo.
Eye Tracking
: Selects to use Eye Tracking data in GazeRaycastRing.
Eye
: Selects one of the Eye Tracking sources, Combined, Left or Right eye.
Best Practice¶
Avoid requirement gazing at edges. The most stabilize eye tracking use H70/V50 (In Unity, It is about one meter in front of view, and with a length and width of 53cm*48cm plane.) as gaze FOV when you design.
You should try to keep the interaction process in these conditions to get more stable feedbacks and eye gaze comfort.
It is not recommended to use cursor guidance for eye tracking directly.
Tips using Unity UGUI¶
When using eye tracking on UI input, it is recommended to arrange interactive objects on a sparse layout. And less use densely spaced UI designs or design of overlapping, so that you can accurately perform select or input behavior.
The size design of each interactive UI object (like button) will have the most helpful of gazing if it is larger than about 4 degrees.
In Unity, It is about one meter in front of view, and with a length and width of 6cm*6cm range.
So it is not recommended to have too small graphic or trigger range.
Troubleshooting¶
- No Eye Tracking data
=> Ensure that you already Modify AndroidManifest.xml and put the Eye Manager in your scene.
- GazeRaycastRing does NOT show the ring.
=> Ensure that your scene had the RaycastSwitch and selected the Gaze Raycast > Enabled
.