📘 CodingMarble Learn

Virtual Reality and Augmented Reality: How They Work

Virtual reality (VR) puts you inside a world made by a computer: a headset shows each eye a slightly different picture, lenses make the screens look far away, and sensors track your head so the picture moves as you look around. Augmented reality (AR) keeps the real world and adds computer objects on top, using a camera to find surfaces or markers. Mixed reality (MR) lets virtual and real objects interact. They are used in games, training, medicine, design and education.

🎬 Step-by-step story

  1. A computer can make a virtual object, like this purple cube. It is not in the real room.
  2. A VR headset has two screens. Each eye sees a slightly different picture. The brain joins them and feels depth.
  3. Lenses sit between the eyes and the screens. They make the close screens look far and big.
  4. Head tracking: turn your head and sensors notice. The picture shifts the other way at once, so the world seems still.
  5. AR is different: a phone camera sees the real table, finds a marker and draws the cube on it.
  6. Free play: switch VR and AR and turn the head. VR replaces the world; AR adds to it.

Tip: drag the 3D scene to turn it. Use two fingers to zoom.

🤔 Common doubts, cleared

If the screen is flat, how do I see depth?

Each eye gets a different flat picture. Your brain compares them and builds depth, just as it does in real life.

How can I focus on a screen so close to my eyes?

The lenses bend the light so the screen appears a few metres away.

Why doesn’t the world turn with my head?

Sensors measure your turn and the picture moves the opposite way by the same angle.

Is a phone filter VR?

No. You still see the real world through the camera; the filter adds to it, so it is AR.

How does the phone know where to put the cube?

It finds the marker on the table, works out its position and angle, and draws the cube there.

What are VR, AR and MR?

All three together are called extended reality (XR).

How a VR headset works

  1. Two pictures (stereoscopy): our eyes are about 6 cm apart, so each sees a little differently. The headset draws two images from two virtual cameras. The brain merges them and feels depth.
  2. Lenses: the screens are only a few cm from the eyes. Lenses make them look far and wide, filling our view (field of view).
  3. Tracking: gyroscopes and accelerometers sense head turns; cameras sense position. The computer redraws the scene for the new view.
  4. Speed: the picture must update about 90 times a second with very little delay (latency). Slow updates make people feel sick (motion sickness).

Controllers, hand tracking and headphones add touch and sound.

How AR works

  1. The camera captures the real world.
  2. Software finds features: a printed marker, a flat floor, a face or a GPS location.
  3. It works out where the camera is and how it is turned (tracking).
  4. It draws the virtual object in the right place and size, and keeps it there as you move.

Examples: face filters, navigation arrows on the road, games that place creatures in a park, a doctor’s view of veins.

Applications, benefits and risks

Uses: games and films; training of pilots, drivers, soldiers and firefighters; surgery practice and therapy; architecture and product design; virtual tours and classrooms; shopping (try on glasses); factory repair with step-by-step AR guides.

Risks and limits: motion sickness and eye strain, less outdoor activity, privacy (cameras record your space), safety (bumping into things), cost of headsets. Use VR in short sessions with a clear space around you.

A simple AR project

  1. Plan: choose what to add, e.g. a 3D model of a planet that appears on a printed picture.
  2. Make the content: a 3D model (made in a 3D tool) or a picture/video.
  3. Choose the trigger: a marker image, a flat surface or a QR code.
  4. Build with a free block-based or web AR tool: link the trigger to the content.
  5. Test on a phone in different light, and improve size and position.

Try it: see stereo with your own eyes

Hold a finger 20 cm in front of your face. Close the left eye, then the right eye, again and again. The finger jumps. Each eye sees a different view: that is exactly the trick a VR headset uses. Then in the 3D, turn the head slider and watch the image move the other way.

Key formulas and definitions

Worked examples

1. A game shows a dragon flying over your real school field through a phone camera. VR or AR?

AR. The real field stays visible and the dragon is added on top.

2. A headset runs at 90 frames per second. How long is each frame?

1/90 s ≈ 0.011 s = 11 ms. The computer must draw both eye images within 11 ms.

3. Why does a VR headset need two images instead of one?

Our eyes are about 6 cm apart, so each sees a slightly different view. Two images copy this, and the brain turns the difference into depth.

4. A trainee surgeon practises an operation on a virtual patient. Give two benefits and one limit.

Benefits: no risk to a real patient; mistakes can be repeated and learned from. Limit: the feel of real tissue (touch) is hard to copy, and good systems are costly.

Common mistakes

Practice quiz

1. Which one replaces the real world completely?
2. A VR headset shows each eye
3. Head tracking uses
4. AR needs the camera to find
5. A common side effect of slow VR graphics is

Practice: answer these yourself

Type or choose your answer, then press Check. Use a hint if you are stuck; the full solution appears after you answer.

Frequently asked questions

What is the difference between VR and AR?

VR replaces your view with a computer-made world. AR keeps the real world and adds computer objects to it.

Is virtual reality bad for the eyes?

Short use is generally fine, but long sessions can cause eye strain and tiredness. Take breaks every 15–20 minutes.

Can I make an AR project without coding?

Yes. Many free tools let you choose a marker and a 3D model and link them with blocks or menus.

Where this is taught

Ukraine9 класDigital creativity
South Korea고등학교 2학년Science and the human future

Learn first

Learn next

Related lessons

All Computer Science lessons