WebXR, one concept at a time

Every page here takes a single WebXR or three.js concept, gives you a demo you can tune with real parameters, and then explains what is actually happening underneath. No headset needed — the demos are built to run on an ordinary desktop browser first, and switch to a real immersive session only when your device supports one.

Start with sessionsAll topics

  • 15concepts
  • 56tunable demos
  • 3essays
  • 2languages

Where to start

The pages do not have to be read in order, but three routes through them come up often enough to be worth naming. Each one starts with the page that establishes the vocabulary the others assume.

  1. You have not written any WebXR yet

    Start with sessions, which is the negotiation every XR page has to go through, then read reference spaces before you place anything in the scene. Those two together are most of what stops a first attempt from working.

  2. You have a VR scene and the framerate is wrong

    Stereo rendering explains where the per-view cost comes from. Foveated rendering and layers are the two ways of paying less of it, and both are easier to judge once you know what you are measuring.

  3. Your AR content does not sit in the room

    Hit testing gives you a surface to place against. Plane detection and anchors are what keep the content there while the runtime keeps revising its map of the room underneath you.

Browse by area

Sessions and lifecycle

How a page asks the browser for an immersive session, and what it is allowed to assume once it has one.

Rendering and presentation

What actually gets drawn, how many times, and who composites the result.

Input and movement

Controllers, hands, and the uncomfortable problem of moving someone through a space they are standing still in.

Understanding the real world

Five ways a runtime tells your page something about the room the user is standing in — each with a different shape and a different lie.

How these pages are written

Each page takes one concept and does three things with it: a demo you can tune with the parameters the real API exposes, an explanation of what the runtime is doing, and a list of the mistakes that cost the most time. The demos simulate the visible consequence rather than the mechanism, because a desktop browser cannot reproduce headset hardware and pretending otherwise would teach you the wrong thing.

The prose is server-rendered HTML. Turn JavaScript off and you lose the demo and keep the entire explanation, which is deliberate: a page whose content only exists inside a canvas is a page nobody can search, quote, or read on a slow connection.

Compatibility numbers are dated where they appear, because they expire. The specification and MDN will tell you what an interface is; these pages are about what happens when you get it subtly wrong, which is the part that costs an afternoon.