How Eye Tracking Works: Pupils, Calibration and Gaze Control in VR

An eye tracker measures where a person is looking, how long they look, and how their gaze moves. This guide explains the two main measurement methods, infrared corneal reflection and camera-based iris landmarks, how 9-point calibration turns pupil positions into screen coordinates, why sampling rate matters, and how dwell selection and attention heatmaps work in VR.

Written by Projectech12 min readPublished
For B.E./B.Tech students building a gaze-controlled VR or wearable project who need to understand how eye tracking measures gaze, calibrates, and turns looking into an input. Topics: MediaPipe Iris, OpenCV, Python, ESP32-CAM, VR Headsets, Eye Tracking
Technical illustration of a VR headset in side-profile cutaway with a small eye camera inside aimed at the wearer's eye and gaze lines running to a floating four-tile menu panel.
Illustration generated for this guide.
In this guide

How Eye Tracking Works: Pupils, Calibration and Gaze Control in VR

Quick answer

An eye tracker measures where a person is looking, how long they look there, and how their gaze moves between looks. It does this in one of two ways: dedicated infrared cameras watch the pupil and the reflection of an infrared light on the cornea, or an ordinary camera finds the iris with a face-landmark model and infers gaze from where the iris sits. Either way the raw measurement is a pupil position, and a short calibration routine turns that position into a point on the screen. The rest of this guide explains each step, why sampling rate matters, and how looking becomes a control input in VR.

What an eye tracker actually measures

Four quantities come out of any eye tracker, and confusing them is the most common mistake in student reports.

  • Gaze point: the spot on the screen or in the scene the eye is aimed at, usually as x and y coordinates. This is the only quantity most demos use.
  • Fixation: a period when the gaze stays roughly still on one spot. A fixation typically lasts a few hundred milliseconds, and it is the unit of attention measurement: the tracker records where each fixation landed and how long it lasted.
  • Saccade: a fast jump of the gaze from one fixation to the next, lasting tens of milliseconds. During a saccade the eye is effectively blind to detail, so saccades are counted separately from fixations.
  • Pupil size and blink: the pupil dilates with light level and with mental effort, and blinks mark the gaps in the data. Both are useful signals, but neither is a gaze measurement on its own.

A heatmap is just a picture of the fixation record: every fixation adds warmth at its screen position, so bright zones show where attention spent time. A heatmap shows where someone looked, not what they understood, and a good report says so.

Method 1: infrared corneal reflection (the DPVR approach)

The DPVR P1 Max Eye, launched on 23 November 2026, is the current reference for this method (all DPVR figures in this guide are reported, not measured by us). Two 400 by 400-pixel eye cameras, one per eye, work with a multi-light-source module. Each light source creates a small bright reflection on the cornea, the clear dome over the iris. The cameras see two things at once: the dark pupil and the bright corneal reflection, called a glint.

The trick is the geometry. When the eye turns, the pupil moves a lot and the glint moves a little, because the cornea is a curved surface and the reflection sits near its centre of curvature. The vector from the glint to the pupil centre therefore changes with gaze direction in a way that depends almost entirely on the eye's rotation, not on where the head is. That is the whole point of the method: head movement shifts both the pupil and the glint together, so their difference cancels most of it out.

Infrared light is what makes this reliable. The eye cameras see infrared clearly, room light barely matters, and the pupil shows up dark against a bright iris in infrared, which makes it easy to find in every frame. The reported figures follow from this hardware: gaze data at 120 to 220 Hz, accuracy of 0.5 to 1 degree, and algorithm latency under 5 ms, with tracking to 30 degrees in each direction. Two eyes also give a depth cross-check that one eye cannot, because both eyes converge on the same point.

Method 2: iris landmarks from an ordinary camera (the student approach)

A student build cannot use infrared eye cameras, so it uses the second method: an ordinary visible-light camera and a face-landmark model. MediaPipe Face Mesh finds 468 3D face landmarks on each frame, and with refined landmarks enabled it adds 10 iris points. The iris centres are landmarks 468 and 473. The pipeline watches where the iris centre sits inside the eye opening and maps that position to screen coordinates.

# Iris centres from MediaPipe Face Mesh (refine_landmarks=True)
LEFT_IRIS_CENTRE = 468
RIGHT_IRIS_CENTRE = 473
# Each frame gives 468 3D landmarks; the two iris centres are
# the pupil positions the gaze mapping starts from.

This method is honest but weaker in three specific ways, and a report should name all three. First, it depends on room light: dim rooms, backlight and reflections from the display degrade the pupil image, and there is no infrared illumination to fall back on. Second, it watches one eye, so there is no binocular depth check. Third, it is slow: a 30 fps webcam gives one gaze sample every 33 milliseconds, while the DPVR hardware reports up to 220 samples per second. Fast eye movements between frames are simply missed.

Why sampling rate matters: saccades are fast

A saccade, the jump between fixations, lasts tens of milliseconds. At 220 Hz the tracker takes a sample every 4 to 5 milliseconds, so it catches several samples inside a single saccade and can measure its speed and landing point. At 30 fps it takes one sample every 33 milliseconds, so a short saccade can start and end between two frames and the tracker sees only the before and after. That is why the sampling gap is a real limitation and not a tuning problem: no amount of smoothing recovers samples that were never taken. The student build is therefore honest about measuring fixations and dwell selection, and honest about not measuring saccade dynamics.

9-point calibration: turning pupil positions into screen coordinates

No eye tracker knows where the screen is until it is told. Calibration is the telling. The wearer looks at nine points in turn — usually a three-by-three grid — and the pipeline records the pupil position at each one. Those nine pairs (pupil position, known screen point) define a mapping from eye to screen, and every later gaze estimate runs through it.

Three things about calibration matter for a build. First, the mapping is personal: eye shape, camera angle and headset fit all differ, so one person's calibration does not transfer to another. Second, it is fragile to refitting: taking the headset off and putting it back on shifts the camera relative to the eye, so the mapping drifts and the demo needs recalibration between sessions. Third, nine points are enough to catch the mapping's curvature across the screen but not enough to fix a bad camera angle — if the camera cannot see the whole eye, calibration cannot save it. Mount the camera below the eye line and angled slightly upward, so the display's reflection stays out of the frame.

Dwell selection: looking as a control input

Once gaze is a screen coordinate, it can be an input. The simplest scheme is dwell selection: hold the gaze on a target for a set time, and the target activates. The student build uses a design-target dwell of about 800 ms, with a progress ring that fills while the gaze holds, so the wearer sees the selection coming.

Dwell selection exists because of a classic problem called the Midas touch: everything you look at would activate, including things you were only reading. A dwell time separates looking from choosing, and the progress ring makes the separation visible. Two implementation details decide whether it works. First, the raw gaze signal is jittery, so the cursor needs smoothing — a short moving average plus a small dead zone around the cursor — or the dwell timer keeps resetting. Second, the timer must reset only when the gaze genuinely leaves the tile, not on every tiny pointer movement; the first version of the student demo reset on every move event and the tile could never reach 800 ms.

Fixations, saccades and the attention heatmap

With gaze samples flowing, the dashboard sorts them into fixations and saccades and draws the result. A fixation is a run of samples that stay within a small area; a saccade is the jump between two fixations. The heatmap is drawn by adding warmth at each fixation point, weighted by duration, so bright zones mark where attention spent the most time.

Two cautions belong in every report that shows a heatmap. First, the map is a record of one session, not a claim about what the wearer understood — looking at a diagram for a long time can mean interest or confusion, and the tracker cannot tell which. Second, the map is only as good as the calibration behind it: a drifted mapping smears every fixation to the wrong place, so the heatmap must be checked against the scene it claims to describe.

The student build: what changes at lab scale

The honest student version of this technology keeps the interaction idea and drops what a college bench cannot reproduce. It replaces two infrared eye cameras with one visible-light USB webcam (or an optional ESP32-CAM module) inside a printed viewer, replaces 120 to 220 Hz gaze output with a 30 fps webcam feed, replaces per-eye SDK data with MediaPipe Iris landmarks computed on a laptop, and replaces a reported 0.5 to 1 degree accuracy with a design-target dwell of about 800 ms and no accuracy claim at all.

The full build — viewer shell, eye camera, gaze pipeline, VR menu demo and attention heatmap dashboard — is published as a project here: DPVR P1 Max Eye-Inspired Eye-Tracking VR Headset Project with Gaze Control and Attention Heatmap. The project page carries the same honesty rules as this guide: DPVR figures are labelled as reported, the student build claims no accuracy figure, and the 30 fps gap is stated as a limitation.

Building your own: a practical checklist

  • Camera placement first. Mount the eye camera below the eye line, angled slightly upward. Mounted straight ahead it catches the phone screen's reflection in the frame, and calibration cannot fix a frame full of reflection.
  • Light the room, not the eye. Steady indoor light is enough for a visible-light camera. Avoid backlight and direct sunlight on the wearer's face.
  • Calibrate per wearer, per session. Nine points, one wearer, one fitting. Recalibrate after refitting the headset or changing wearers, and say so in the report.
  • Smooth before you select. A moving average over recent gaze samples plus a small dead zone keeps the cursor still enough for dwell selection to work.
  • Log everything. Record fixations with position and duration, count saccades separately, and keep the raw gaze samples so the report can show the calibration runs and where the mapping drifted.
  • Demo indoors. Spectacles, contact-lens glare and screen reflections can hide the pupil from the camera, so check each wearer calibrates before the review, not during it.

Frequently asked questions

Is eye tracking the same as face tracking?

No. Face tracking finds the face and its landmarks in the image. Eye tracking goes one step further and turns the iris position into a gaze direction, then into a screen coordinate through calibration. A face tracker can tell that a person is present and roughly where they look; an eye tracker gives a gaze point precise enough to select a menu tile.

Why do commercial headsets use infrared instead of a normal camera?

Infrared gives the tracker its own light. The pupil is dark and the corneal reflection is bright in infrared regardless of room lighting, so the cameras see the eye clearly in any room. A visible-light camera depends on the room, fights display reflections, and needs the iris landmarks to do the work the infrared hardware does optically.

How accurate is a student eye-tracking build?

No accuracy figure should be claimed unless it was measured, and the student build in the linked project claims none. What it demonstrates is repeatable: a 9-point calibration maps pupil position to screen coordinates, a dwell of about 800 ms selects a menu tile, and the dashboard logs fixations. The report records calibration runs and where the mapping drifts instead of inventing a number in degrees.

What is the Midas touch problem?

Everything you look at would activate if looking alone were the trigger, including text you were only reading. Dwell selection solves it by requiring the gaze to hold still for a set time, and the progress ring shows the wearer that a selection is coming. Blink-to-click is sometimes proposed as an alternative, but a blink is also a reflex, so it needs the same kind of guard.

Can eye tracking diagnose vision problems or attention disorders?

No, not in a student build. Clinical eye tracking uses calibrated medical hardware, controlled stimuli and validated protocols. A DIY headset is an engineering demonstration of gaze interaction and attention logging, and it must never be presented as a vision test, a diagnostic tool or a clinical attention measure.

Why does the student build sample at 30 fps when DPVR reports 220 Hz?

Because its camera is a 30 fps webcam, and the sampling rate is set by the camera, not by the software. Saccades last tens of milliseconds, so a 30 fps feed misses fast eye movements between frames. The gap is a stated limitation of the build, and the demo is designed around what 30 fps can honestly measure: fixations and dwell selection.

Limitations

  • This guide describes the technology, not a medical device. Nothing here is a vision test, a diagnostic procedure or a clinical measurement.
  • DPVR figures (US$999 price, 120 to 220 Hz, 0.5 to 1 degree accuracy, under 5 ms latency, 30-degree tracking range) are the manufacturer's reported figures for the P1 Max Eye, launched 23 November 2026. They describe the commercial product, not any student build.
  • Visible-light eye tracking depends on steady indoor light and a clear view of the pupil. Spectacles, contact-lens glare, screen reflections and dim rooms degrade it, and it has no infrared illumination to fall back on.
  • A single-eye build has no binocular depth check and no per-eye data. Its combined gaze point is an estimate from one eye.
  • Calibration is personal and fragile to refitting. A mapping built for one wearer and one fitting does not transfer, and drift between sessions is expected.
  • A heatmap records where gaze spent time. It does not measure understanding, interest or learning, and a report must not claim otherwise.

More project guides

More in IoT & Embedded