Fresh in my mind from building a simple raytracer, I wanted to keep experimenting with graphics programming using wgpu. On my list of ideas was a simulation of slime mold. Essentially, you simulate millions of tiny particles that move around according to some simple rules and render the results.
My simulation is implemented as a compute shader that runs on the GPU. A simple render pass then takes the results of the simulation and renders them to the screen. There’s only a few rules that govern the movement of the particles:
Using these rules, the particles will form a network of connections that resembles slime mold. The simulation is quite fast, and can handle millions of particles without any issues.
As always, there is a lot more that can be done to improve the simulation. For example:
I also had ideas for programming the simulation somehow, by compiling a lisp DSL into the compute shader. I hope to explore this idea in the future.