Visualizations
412 / 500

412 · 3D

Shadow Sculpture

One carved object casts three different shadows at once. Draw your own.

Three silhouettes, one on the left wall, one on the back wall and one on the floor, are each pushed straight through the room, and the sculpture is the intersection of the three extrusions (a visual hull) carved into a 32 x 32 x 32 voxel grid. Three parallel spotlights shine along the three axes, so every wall receives exactly one shadow, the projection of the voxels, and the shadows come out perfect even though the object looks like a jumble from any other angle, the trick behind the cover of Goedel, Escher, Bach. The walls are ray cast per pixel with soft shadow maps built by splatting each surface voxel's exact footprint and blurring it into a penumbra, and the sculpture goes through a perspective-correct, z-buffered triangle rasterizer with per-corner voxel ambient occlusion and self shadows marched through the grid. Spin it on its turntable and the shadows dissolve, then snap back into letters as it comes home.

Try it. Draw on a wall or the floor to change its silhouette and recarve the sculpture live (right-click or Shift erases); faint pencil lines show what you drew, so you can see where the three drawings disagree. Type letters to put them on the walls in turn, pick a preset, press Enter or Spin to turn the sculpture, and drag anywhere else to walk around it.

  • Visual hull carving
  • Shadow map splatting
  • Perspective-correct rasterizer
  • Voxel ambient occlusion

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 a "shadow sculpture" with JavaScript and the HTML canvas element: one voxel object that casts three different shadows on three walls at once. 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:
- Make a canvas that fills the window and stays sharp on high-DPI screens.
- Make three 24 x 24 masks by drawing a big bold letter into a tiny offscreen canvas with fillText (say G, E and B) and reading the pixels back with getImageData.
- Carve the sculpture: a 24 x 24 x 24 voxel grid where voxel (x, y, z) is filled only if the first letter covers (z, y), the second covers (x, y), and the third covers (x, z). That is the intersection of three extrusions, also called a visual hull.
- Draw it isometrically: sort the voxels back to front and draw each as three shaded parallelograms (top, left, right).
- Next to it, draw the three shadows by projecting the voxels along each axis (a cell is dark if any voxel lies on that line), and check that they spell the three letters.

Once that works, make it beautiful:
- Place the sculpture in a room corner: a left wall, a back wall and a floor, each lit by a parallel light along one axis, and paint each wall's shadow on it with a soft, blurred edge.
- Let me drag to orbit the camera, so I can see how strange the object looks from other angles while the shadows stay perfect.
- Let me type three letters to recarve it, and add a button that spins the sculpture so the shadows fall apart and come 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 drawing the silhouettes with the mouse, adding ambient occlusion to the voxels, or exporting the sculpture as an STL file for 3D printing.
PreviousFoveated VisionWhat one eye really captures: a sharp fovea, a blurry gray periphery and a blind spot. NextHanging Chain ArchesHang chains and weights, then flip the sheet to turn them into stone arches.

Related visualizations

  • Voxel Diorama3D A floating voxel island with baked AO, sun shadows and a waterfall. Click to build.
  • SDF Sculptor3D Digital clay: press on soft lumps or carve them away, ray marched in a tiny photo studio.
  • Checker ShadowIllusions Squares A and B are the exact same gray. Move the light and the shadow keeps lying.
  • Hidden 3DIllusions A live magic eye picture: a turning 3D sculpture hidden in colorful noise.
  • Sprite StackingRetro A cozy pixel town where every house, car and tree is a pile of flat slices.
  • Sundial Garden3D A pastel garden lit by the real sun, with shadow-mapped shadows and a working sundial.
  • Light & ShadowPhysics Red, green and blue lights cast crisp, colored shadows through spinning shapes.
  • Voxel SpaceRetro Fly low over a mountain valley with the 1992 Comanche terrain trick.
  • Anamorphic Chalk3D Pavement chalk that snaps into a chasm, a stairway or floating cubes from one spot.

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

← More from Emergent Mind Labs