projects26

Relativity

time
2026
team
Personal project
type
Real-time interactive space, in the browser
built with
three.js, WebGL 2, a Web Worker for generation

A walkable, endlessly generated space after M. C. Escher’s lithograph Relativity (1953), drawn in real time as an etching.

You start in front of the print: a 3D reconstruction of it, seen through the print’s own camera. Click one of its sixteen inhabitants and the plate grows to fill the screen while the camera dives into that figure’s eyes. From there you walk, and the ground under your feet decides which way is down. Walk into a wall and keep pushing, and the wall becomes your floor. Walk off an edge, and you roll over it onto the side below. Every staircase serves two gravities, as in the print: one people climbs its treads while another walks its risers. Everything beyond the print’s three halls is generated as you approach it.

The title screen: the reconstructed print on cream paper, with the line “Choose an inhabitant — click a figure to step into its world”
live · runs in your browser · needs WebGL 2, a keyboard and a mouse open full screen

controls

click a figure
Step into its world
W A S D
Walk (arrow keys work too); Shift to run
mouse
Look around
space
Jump. Off an edge you fall along your gravity to the ground below
into a wall
Push for a moment, and that wall becomes your floor
over an edge
Roll over onto the face below
esc
Pause, then resume or return to the print

01

The print, reconstructed

Relativity is drawn in true three-point perspective, so its camera can be recovered. The print’s straight edges were detected and fitted to three vanishing points, which give the focal length (a vertical field of view of about 52°) and the camera’s orientation: it looks up about 32° into the corner where the ceiling and two walls meet. Each staircase, landing, arch and opening was then placed by casting rays from the print through that camera onto the plane it lies on, and each inhabitant was lifted to 3D from the size it is drawn at.

The hall’s three peoples are the print’s: the floor people, upright; the left-wall people, such as the garden party seen through the arch; and the right-wall people, such as the couple in the garden at the top left. On the top stairway, a left-wall person and a right-wall person walk side by side, each on their own face of the same steps.

The reconstruction drawn in outline only, at the print's exact framing: the crossing staircases, the arch, the barred window and the figures on three different gravities
The reconstruction in outline only, at the print’s exact framing.

02

An endless lattice of halls

The world is a lattice of halls. Each hall is a 40 × 40 × 40 voxel cube, about 20 metres a side, and neighbouring halls share a wall. Whether that wall exists, and how it is opened up, is a pure function of its position, so two halls always agree on it no matter which is generated first. About a third of the walls are missing altogether; most of the rest are arcades, grand arches or frames around one huge opening, so the halls run into each other.

Inside a hall, features are placed and then validated. The vocabulary is Relativity’s: corner stairs, thin double-sided stairs flying from floor to wall, balconies with doors to the “basements” beneath them, bridges, towers, columns, gardens, urns and statues. Each feature is written once and can be rotated into any of the 24 orientations of the cube, so it can belong to any of the six gravities. It is only committed if the voxels it fills are free, the voxels it needs empty stay empty, and the voxels it hangs on are already stone. Stairs are 45° wedges, walkable by both gravities whose “up” lies in the wedge’s normal, which is what makes one staircase usable by two peoples at once.

Looking down into a generated hall during the dive: a tiled floor, a tower with a balcony, stairs and a garden, all drawn in dense parallel hatching
Diving into a hall, drawn as an etching.

03

Drawn as an etching

The etching is two passes. First the scene is drawn with hatching laid out in world space on every face, one, two or three layers of lines depending on tone. Each line family doubles or halves its spacing with distance, so the density of lines stays constant on the “paper”, like a real engraving. Then a screen pass draws ink outlines wherever depth, surface orientation or material changes, fades distant ink into the paper and adds paper grain. Tone comes from a fixed light and from ambient occlusion read out of a 3D texture of the voxels around you, which darkens the hatching in corners and recesses.

Halls are generated in a Web Worker, closest first, and dropped when far away. Fog fades everything beyond about 30 metres into the paper, so the edge of the world is never visible.

Relativity is a work by M. C. Escher. This project is an homage and is not affiliated with the M. C. Escher Company.