Mobile
GRAINS
A glass box with thousands of grains of coloured sand inside your phone. Tilt the phone and the sand pours. The simulation runs on the GPU.

Problem
A relaxing toy has to respond instantly and smoothly. Thousands of grains computed on the phone’s CPU would eat the battery and the frame rate.
Solution
The sand simulation runs in shaders (a Margolus cellular automaton) on a chain of SubViewports in Godot. The only control is the phone’s tilt, read from its sensors.
Highlights
- Thousands of grains simulated on the GPU.
- A CPU reference implementation checks the shaders in tests.
- Tilt is the only control; on desktop the keyboard and mouse stand in for it.
- Headless tests in CI plus separate GPU shader tests.