Black Hole Sandbox
Black Hole Sandbox puts a scientifically accurate black hole on your iPhone, and then lets you ruin it with emojis.
Description
Black Hole Sandbox puts a scientifically accurate black hole on your iPhone, and then lets you ruin it with emojis.
The black hole is real physics. A Metal compute shader traces light rays through curved spacetime using the Schwarzschild geodesic equation, so the galaxy behind the hole stretches into arcs, the far side of the accretion disc lifts above and below the shadow, and a thin photon ring wraps the edge. It runs live at 60fps on the phone, in 3D or in augmented reality, where the black hole bends your actual living room.
Then the designer takes over: 37 colour palettes, 14 disc textures, 14 geometric facet patterns, dials for glow, tilt, gap and spin, your own photos on the accretion disc, or a swarm of emojis orbiting the shadow.
How it was built. Written in Swift with Claude Code: SwiftUI, RealityKit and a Metal post-process kernel, built as a second target inside my space game's Xcode project so it shares the renderer. Prompts were rarely "build me a black hole". They were things like "the emoji standees split in half behind the hole" and "the lensing shimmers when emission is on" — one symptom at a time.
The hardest part was a seam where the bent light ray crossed the accretion disc. Hours of plausible theories all failed. What fixed it was instrumenting the shader instead: painting each pixel by which code path drew it, so the colours named the boundary the seam sat on. It turned out the ray was being intersected against a straight chord rather than the curved arc it actually travels.
More in Games

