Visualizations
478 / 500

478 · Illusions

Impossible Architecture

Walkers climb Penrose stairs forever on a pastel tower whose paths only meet on screen.

An isometric camera looks down the (1, 1, 1) diagonal, so points that differ by any multiple of that vector land on the same pixel. The walk graph is built in screen space: two tiles are neighbours when their projected tops sit one grid step apart, plus at most a stair riser, whatever their real depth. The crown is a true Penrose staircase, 6 steps east, 6 south, 2 west and 2 north, each a quarter unit up, an open spiral whose end sits exactly (4, 4, 4) in front of its start, so one walker climbs and another descends forever. The bridge pivot really stands at balcony height in front of the island, and a quarter turn swings its arm from lining up with the ground path to lining up with the balcony. Boxes are drawn with a topological painter's sort and every arch, door and tread is painted in face coordinates through an affine transform; orbit away and dashed lines show how far apart the joined tiles really are.

Try it. Tap any tile to send the red walker there along the screen-space graph, and tap the blue bridge (or press R) to turn it. Drag to orbit off the isometric axis and watch the structure come apart, then press I or Isometric view to snap the illusion back.

  • Isometric projection
  • Screen-space adjacency graph
  • Topological painter's sort
  • Penrose stairs

View the source · one module, plus a small shared runtime for sizing, the animation loop and input

Build your own

Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.

Build an Escher-style impossible staircase with JavaScript and the HTML canvas element: a little figure climbs a loop of stairs forever and never gets any higher. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.

Start simple:
- Write an isometric projection: screenX = (x - y) * 0.707, screenY = (x + y) * 0.408 - z * 0.816, scaled and centered. Note in a comment that any two points differing by k * (1, 1, 1) land on the same pixel.
- Build the Penrose stairs as 16 treads: 6 steps along +x, 6 along +y, 2 along -x and 2 along -y, each tread 0.25 higher than the one before. Show in a comment that the last tread ends exactly (4, 4, 4) away from the first, which is why the loop closes on screen.
- Draw each tread as a box (top face plus the two visible side faces with three shades of one pastel color), sorted back to front by x + y + z.
- Put a small figure on the stairs and move it from tread to tread around the loop, adding one to a 'steps climbed' counter each time.

Once that works, make it beautiful:
- Give the treads alternating colors and let each flight's side wall reach down to a common base so the sawtooth profile reads clearly.
- Put the stairs on top of a pastel tower with arched windows and a floating island, and add soft clouds behind.
- Add a slider that swings the camera a little away from the isometric axis so the stairs visibly come apart into an open spiral, then snap back.

Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as building the walk graph from screen-space adjacency so other paths can join, adding a rotating bridge that connects two floors only on screen, or a second figure walking down forever.
PreviousAnt FarmA colony digs its nest grain by grain behind glass, with no plan but local rules. NextWind HarpAn Aeolian harp on a misty hill: vortex shedding picks the harmonic each string sings.

Related visualizations

  • Shepard StaircaseIllusions A procession climbs Penrose's impossible stairs while a Shepard tone rises forever.
  • Impossible Rooms3D A house that cannot exist: a ballroom in a wardrobe, a corridor longer inside than out.
  • Point-Light WalkerIllusions Thirteen dots on black, and you see a person walking, running, dancing or carrying a box.
  • Procedural CityGenerative art An isometric city that builds itself and runs through day and night.
  • Basalt ColumnsNature Cooling lava cracks into columns that drift toward hexagons, on an isometric causeway.
  • Penrose PentagridMath Five grids of parallel lines dualize into a living Penrose tiling of stained glass.
  • Ames RoomIllusions Identical twins become a giant and a child inside a room that only looks square.
  • Hyperbolic MazeGames A labyrinth in negatively curved space: the world glides past while you stay at the center.
  • Roguelike ExplorerRetro An amber-terminal dungeon crawl that explores itself, cat in tow, by rolling down a Dijkstra map.

Use ← and → to move between demos. While the canvas has focus, keys go to the demo instead.

← More from Emergent Mind Labs