Book a free call

Computer Vision in AR and VR: How Headsets Track the World

Computer vision is what lets AR and VR headsets track where you are, where your hands are, and where virtual objects should sit. Here is how the tracking works.

Hertiv engineering teamReviewed by a senior engineer
5 min read
Computer Vision in AR and VR: How Headsets Track the World
On this page

Short answer

Computer vision in AR and VR is the set of techniques that lets a headset work out its own position, track the wearer's hands and eyes, and place virtual objects so they stay fixed in the real world. Cameras on the headset watch the room, and software turns those images into a live 3D map that the headset uses to render each frame.

What does computer vision do in AR and VR?

Computer vision is the headset's sense of place. Without it, a headset would not know where it is, which way it faces, or where the wearer's hands are. Every virtual object would drift, and the experience would feel broken within seconds.

In virtual reality, vision tracks the headset and the controllers so the virtual world moves correctly as the wearer turns and walks. In augmented reality, vision does that job and more: it must also understand the real room, so a virtual chair can sit on a real floor and stay hidden behind a real table when the wearer walks past.

The work splits into three jobs: tracking the headset, tracking the hands and eyes, and mapping the room. Computer vision handles all three, using the same camera images in different ways.

How does a headset track where you are?

A headset tracks its position with a technique called SLAM, which stands for simultaneous localisation and mapping. As the wearer moves, the cameras watch fixed points in the room, such as corners, edges and patterns on the walls, and work out how the headset moved between frames.

SignalWhat it givesIts weakness
Camera imagesPosition from room featuresStruggles in blank, featureless rooms
Motion sensorsFast rotation and accelerationDrifts over time without correction
Depth sensorDistance to walls and objectsShort range, higher power use
Eye trackingWhere the wearer looksNeeds calibration for each person

Motion sensors react fast but drift, so the camera readings correct them many times per second. When the room has few features, such as a plain white wall, tracking gets weaker, which is why some headsets add small markers or use a depth sensor to fill the gaps.

How do headsets track hands and eyes?

Hand tracking starts with the cameras finding the hands in the image, then fitting a model of the hand with its joints and fingers. The software tracks 20 or more points per hand, so it can tell a pinch from a grab or a point.

Eye tracking uses small infrared cameras inside the headset that watch the pupils. It works out where the wearer is looking, which helps in two ways: the system can render the looked-at area in full detail and the rest more cheaply, and it can let the wearer select things just by looking at them.

Both kinds of tracking need good light on the hands and face, and both fail when the hands leave the cameras' view. That is why many headsets still ship controllers as a backup: a controller is easy to track even when the cameras cannot see the hand.

How do virtual objects sit correctly in a real room?

Placing a virtual object in a real room takes three steps. First the headset builds a 3D map of the room, including floors, walls and furniture. Then it anchors the virtual object to a point in that map. Then, as the wearer moves, it redraws the object from the new viewpoint.

Occlusion is the hard part. If a virtual ball rolls behind a real sofa, the headset must hide the part of the ball that the sofa covers. That needs a depth map of the room, updated as things move. Without it, virtual objects look pasted on top of the world instead of sitting inside it.

Lighting matters too. A virtual object lit from the wrong direction looks fake, so the headset estimates the room's light from the camera images and shades the object to match. AI in virtual reality covers the wider uses, from training to therapy, that this tracking makes possible.

Where is AR and VR vision used?

Training is the biggest use. A factory worker can practise a repair on a virtual machine, with the headset tracking their hands and showing each step in place. A surgeon can rehearse a procedure on a virtual patient before the real one. Both save the cost and risk of practising on real equipment with real people nearby.

Design and review come next. Architects walk clients through a building that does not exist yet, and engineers check a machine design at full size before it is built. AR and VR trends show these enterprise uses growing faster than games.

Remote help is another use. An expert sees what a field worker sees through the worker's headset camera and draws arrows in the worker's view to show where to look or what to turn. The vision system keeps those arrows fixed on the right part of the machine.

Example (hypothetical): a warehouse training app

Example (hypothetical): a warehouse builds a training app for new pickers. The headset maps a 200-square-metre training area, tracks the trainee's hands, and shows a virtual shelf with 40 bins to pick from.

Each trainee runs 10 picking rounds of 5 minutes. The app records 3 wrong picks per trainee on the first round and 1 wrong pick by the fifth round. Hand tracking stays accurate for 9 of the 10 rounds; on the tenth, the trainee's hands leave the camera view twice and the app pauses with a message to bring the hands back into view.

After two weeks, 12 trainees finish the course. Their average picking time falls from 4 minutes 30 seconds per round to 3 minutes 10 seconds, and the trainers use the app's logs to see which bins cause the most errors.

What are the common mistakes?

The most common mistake is testing only in a tidy demo room. Real rooms have blank walls, mirrors, moving people and changing light, and each of those weakens tracking. Test where the headset will actually be used.

Another mistake is ignoring drift. A headset that tracks well for one minute can drift over ten, so virtual objects slowly slide away from where they should be. Test long sessions, not just short demos.

A third mistake is placing virtual objects without a depth map. Objects that ignore occlusion look wrong and break the feeling that they belong in the room. If the headset has no depth sensor, keep virtual objects away from real furniture.

Finally, teams sometimes forget the hands. Hand tracking fails when hands leave the camera view or move too fast, so give users a clear signal when tracking is lost, and a controller as a fallback.

Key takeaways

  • Computer vision gives a headset its sense of place: position, hands, eyes and the room.
  • SLAM tracks the headset by watching fixed points in the room, corrected by motion sensors.
  • Occlusion needs a live depth map, or virtual objects look pasted on top of the world.
  • Test in real rooms and long sessions, not just tidy demos.
  • Keep controllers as a fallback for when hand tracking loses the hands.

Frequently asked questions

What is SLAM?

SLAM stands for simultaneous localisation and mapping. It is how a headset works out where it is while building a map of the room at the same time, using the cameras to track fixed points as the wearer moves.

Why do virtual objects drift?

Tracking errors build up over time, so the headset's idea of where it is slowly moves away from reality. Camera readings correct the drift, but only when the room has enough features to track, which is why blank walls cause trouble.

Do I need controllers if I have hand tracking?

Not always, but controllers are a useful fallback. Hand tracking fails when hands leave the camera view or move very fast, and a controller keeps working in those cases, so most headsets still ship with them.

Can AR work outdoors?

Yes, but it is harder. Bright sunlight, moving crowds and large open spaces give the cameras less to hold on to, so tracking is weaker than in a small indoor room and virtual objects may drift.

What is occlusion in AR?

Occlusion is hiding the part of a virtual object that sits behind a real object. It needs a depth map of the room, so the headset knows which real surfaces are in front and can draw the virtual object behind them.

How much does an AR or VR headset cost?

Prices vary widely by device and by what is included, from standalone headsets to PC-linked systems with controllers and trackers. See vendor sites for current prices before choosing a device.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: AI and agent systems in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Building an AR or VR experience that has to track the real world?

A senior engineer replies within one business day. Or see our Computer Vision service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to [email protected].

Prefer email? Write to [email protected]
Estimate costBook a call