This is a Neural Cellular Automaton (NCA) — a tiny neural network that runs independently in every cell of a grid, reading only its immediate neighbors. Despite having no global coordination, the cells collectively grow and maintain complex patterns from a simple seed.
Each cell holds 16 channels: 3 visible (RGB) and 13 hidden "thought" channels. Every step, each cell:
The update rule was trained in PyTorch to regenerate target patterns from damage. This page runs the trained weights in WebGL2 fragment shaders at 60fps, with the same math as the Python original.
16 NCA channels are stored as 4 RGBA float16 textures on the GPU, double-buffered for ping-pong rendering. The 128-unit hidden layer is computed across 4 shader passes (32 units each) with delta accumulation. Sobel perception, stochastic masking, and brush interaction are separate shader passes. Total: ~8K learned parameters per model.