WebGPU · runs on your GPU

Slime Mold Simulation

Millions of agents, each dropping a trail and steering toward the strongest scent ahead. Three tiny rules, life-like networks. It all runs in real time on your graphics card — no server, no upload.

⚡ 100% on-device — your GPU does every frame

Starting the GPU…

Setting up WebGPU and seeding the agents.

How does this run in your browser?

Every frame, three things happen entirely on your GPU through WebGPU compute shaders. First, a compute pass moves each agent: it samples the trail map at three points ahead (left, center, right), steers toward the strongest one, steps forward, and deposits a little trail where it lands. Second, another compute pass blurs and fades the whole trail map so old paths slowly evaporate. Third, a render pass reads the trail map and paints it through a color gradient. With WebGPU the agent pass and the map pass both run thousands of threads in parallel, which is why a laptop can push 700k to a few million agents at a smooth frame rate without ever touching a server.

What you are looking at

This is a model of Physarum polycephalum, a slime mold famous for solving mazes and re-deriving the Tokyo rail map by connecting food sources with efficient tubes. No agent has a plan. Each one only follows the rule "drop a scent, then turn toward more scent." Reinforcement does the rest: faint trails fade, busy trails thicken, and the population self-organizes into branching transport networks. It is one of the cleanest examples of emergence you can watch happen live.

Things to try

Drag on the canvas to pull the colony toward your cursor, or switch the mouse to Repel and carve channels through it. Widen the sensor angle for lacy webs, shrink it for tight veins. Push turn speed up for nervous, crystalline structure and down for long sweeping arcs. Lower the trail decay and the network ossifies into rigid lattices; raise it and everything stays liquid. Found a look you like? Hit Copy share link and the exact settings travel in the URL, or Save PNG for a wallpaper-grade still.

Privacy and performance

Nothing is uploaded and there is no account. The simulation, the rendering, and the image you save all stay on your machine. It needs a WebGPU-capable browser — recent Chrome, Edge, or Safari work well; Firefox needs WebGPU enabled. If your device is modest, drop the agent count and it will keep a steady frame rate.

How can millions of agents run client-side?

WebGPU exposes your graphics card to the page. The agents live in a GPU buffer and the trail lives in another, and compute shaders update them in parallel — tens of thousands of threads at once — so there is no per-agent JavaScript loop and no server round trip.

What are the three sliders that matter most?

Sensor angle and sensor distance set how the agents "see" the trail, and trail decay sets how long paths persist. Those three control whether you get fine webs, thick veins, or rigid lattices.

My browser says it is not supported.

It needs WebGPU. Update to a current Chrome, Edge, or Safari, or enable WebGPU in Firefox. A desktop GPU gives the best results.

Is it really private?

Yes. The whole thing is one HTML file that runs locally on your GPU. No upload, no tracking of your inputs, no sign-up.

I build things like this for a living.

Senior full-stack engineer comfortable from WebGPU shaders to production backends, available for senior or contract work, fully remote. See the rest of the lab or get in touch.