~/todd-fleeman/case-study — session log entry

~/Shadow Box One

started 2026-09-13 · last touched 2026-09-14
why this exists

This is an old learning project, rebuilt. The original was one of my first attempts at 3D on the web. Rather than leave it gathering dust, I rebuilt it in React Three Fiber, to see how much of what I'd learned the hard way the modern tooling now handles for me. It's simple on purpose: a spinning cube, one light, and a wall to catch the shadow. Move your mouse and the light follows, so the shadow swings and stretches across the back wall in real time.

built on / learned
React Three Fiber
Learned
  • Shadows are opt-in, three times over. The canvas has to enable shadows, the light and the cube both have to cast them, and the wall has to receive them. Miss any one and nothing shows up, with no error to tell you why.
  • The frame loop lives in a hook. useFrame runs every frame, and refs give it something to move. The cube's spin and the light's position both update there, outside React's render cycle.
  • Mouse position needs translating. The pointer comes in normalized, -1 to 1 across the canvas. That has to be scaled into the scene's own units, or the light barely moves.
  • A wall that's only a shadow. A shadow material draws the shadow and nothing else, so the cube's shadow appears to float on the page instead of on a gray plane.
where this might go

Swap the cube for cut-paper characters and the light for a flashlight, and this becomes a shadow puppet theater: a kid moves the light, and the characters' shadows loom, shrink and dance across the wall. Swap the art again and it's a spooky storybook page where you shine a light into the dark to find what's hiding, or a product viewer where shoppers light the item themselves instead of looking at one fixed photo.