Diffusion and Dendrites
To see the animation, turn on the "Run" option. Give it a chance to run for a while to see the results.
This demo simulates a cloud of white particals diffusing by Brownian motion. At the start, there is also a solid line of yellow particles and a line of cyan particles. Yellow and cyan particles don't move. When a white particle hits a yellow or cyan particle, it changes color to match and stops moving. The original lines of yellow and cyan particles grow in an interesting way, forming "dendrites" or filaments.
In a single timestep, each white particle moves by one pixel. The program can do several timesteps between frames. The "Speedup" menu controls the number of time steps per frame. Larger values give a faster simulation.
In addition to the render pass that draws the particles, the program uses two WebGPU compute shaders to update the partical positions.