← All labs

THRESHOLD

Step through a ring into another world
three.js · Stencil portal · Gyroscope

Labs / 10

Try it live →

(Overview)

A golden ring, with a whole world on the other side.

Threshold is a doorway. From outside, the ring shows a slice of somewhere else, and nothing around it. Step through and that world wraps right round you: a ringed planet on one side, a neon city on another, twin suns setting behind.

On a phone you look around by turning your body, because the gyroscope steers the view. Turn back to face the ring and it has become a porthole onto the room you left, filled by your phone's camera. It's a single web page, with no app, no login and nothing to download.

Type
Browser experiment, no install
Rendering
three.js, with a stencil-buffer portal
Looking around
Phone gyroscope, or drag on desktop
The world
Drawn in code, with no image or video files
Status
Portal and 360° world working, camera AR next
Live lab
Open Threshold ↗

(How it plays)

  1. ◯Find the ring and drag, or turn your phone, to look round it
  2. →Step through to cross into the world
  3. ↻Look around the full 360°
  4. ◉Turn back and the ring shows your camera, if you allow it
01

Cut a hole in the scene

The portal is a masking trick. An invisible disc inside the ring marks its own pixels, and the far world, painted on the inside of a huge sphere, is drawn only where that mark is. So from any angle you see the world through the ring and nowhere else.

02

Cross the line

Every frame, the page checks which side of the ring you're on. The moment you cross, the rule flips: the world is drawn everywhere except the ring, and the ring shows your camera instead. The camera is only asked for as you step through, and the picture never leaves your device. Say no and the ring simply stays dark.

03

Work on every phone

iPhones don't support WebXR, the browser standard for AR, and a plain, smooth ring gives image tracking almost nothing to lock on to. So the core runs on the gyroscope, which every phone has. Anchoring the ring in your actual room is the next step, and it will need an ornate, patterned ring for the camera to follow.

Try Threshold All labs