Infinite Powder
Interactive

Infinite Powder

Year
2024
Type
Browser Experience
Renderer
WebGL / GLSL
Platform
Web
Overview

Infinite Powder is a generative browser experience built around cellular automata and falling-sand simulation — a genre of interactive software with roots in early 1990s Japanese doujin games, popularised by the web by tools like Powder Game and Sand, and never quite leaving the cultural consciousness of programmers and creative coders.

The project is simultaneously a rigorous technical exercise and a genuinely playable interactive artwork. Cellular automata rules govern how each particle type behaves and interacts with its neighbours — sand falls and piles, water flows and pools, fire spreads and consumes, gas rises and diffuses. The rule system is layered: each material has primary physics rules and secondary interaction rules with every other material type, producing emergent behaviours that even the author finds surprising.

The simulation runs entirely in the browser on the GPU via WebGL, with the cellular automata grid state encoded into texture buffers that are updated by GLSL compute shaders each frame. This approach allows hundreds of thousands of particles to be simulated simultaneously at frame rates that a CPU-side implementation would never reach.

The visual output is particle rendering — each cell in the automata grid is rendered as a particle with material-appropriate colour, opacity, and glow properties. The result has a tactile, almost physical quality: you feel the weight of sand, the restlessness of fire, the reflective surface of pooled water. As an interactive artwork it's something you play with rather than play through — there's no goal, just the pleasure of watching emergent complexity unfold from simple rules.

AI Workflow

Claude authored the core simulation rules

The cellular automata rule system is the heart of the project, and it was designed and written collaboratively with Claude. Describing the desired physics in natural language — "sand should fall straight down, slide diagonally if blocked, and form stable piles at the angle of repose" — and iterating on Claude's implementations produced a physics model that is both plausible and satisfying to interact with. The multi-material interaction matrix (what happens when fire meets water, when acid meets stone, when gas accumulates above flame) was explored in conversation and then implemented in code.

WebGL shader architecture

The decision to run the simulation on the GPU required designing a GLSL shader architecture capable of reading a current-state texture, applying cellular automata rules in parallel across all cells, and writing to an output texture in a single render pass. This is a non-trivial problem — cellular automata have ordering dependencies that conflict with GPU parallel execution. Claude designed the checkerboard update pattern that resolves this: alternating which cells update on even vs odd frames eliminates race conditions while maintaining physically plausible behaviour.

Interaction model design

How the user interacts with the simulation — brush size, material selection, painting gestures, erasing — was designed with AI assistance. Asking Claude to critique early interaction prototypes and suggest improvements led to a more fluid UI that gets out of the way and lets the simulation be the focus. The pressure-sensitive brush that varies particle emission based on cursor velocity was Claude's suggestion after reviewing an earlier fixed-size implementation.

GPU-side collision debugging

Debugging GPU-side code is notoriously difficult — you can't set breakpoints in a shader. Several persistent artefacts (particle tunnelling through barriers at high velocities, colour bleeding between material types) were diagnosed by describing the symptoms to Claude, receiving hypotheses about likely shader logic errors, and then using those hypotheses to guide manual inspection of the GLSL code.

Tech Stack

A pure web stack — no frameworks, no dependencies. Just WebGL, GLSL shaders, and vanilla JavaScript running cellular automata on the GPU.

WebGL GLSL JavaScript Canvas API Claude AI
Play on VIVERSE Open in VIVERSE ↗
Infinite Powder on VIVERSE
Next Project
VIVERSE World Explorer