Trudging through old projects and found my slime-mold simulation and polished it up a bit:

Here’s an earlier vid - same simulation but with a different set of parameters and less frills:

The basic way a slime mold sim works is by creating millions of cells, who have a position and angle (to specify which way they’re facing). Each frame, cells create a small scent behind them, and this scent spreads out and disolves over time. Cells look at positions in front of them and turn slightly in order to face the strongest scent it can find, and then move in that direction.

The way I’ve implemented it in Unity is to use compute shaders to run the actual sim, using a bitmap to store the scent values.

The extra layer here in the above videos is that I’m also using a render texture to add extra data to the sim to create ‘fake’ scent values. This leads to creating a sort of “dithering” effect, where the slime mold sim accidentally recreates a ghost of the image from the render texture out of simulated slime.

Because of the amount of variables (such as the speed of the cells, or how fast they can turn, or how quickly the scent dissolves, etc), slime molds have a huge parameter space. In order to play around with it easier, I hooked up these variables to my midi controller to it via MINIs so you could fiddle about by turning physical knobs rather than using Unity sliders.