This is a Unity Demo for the Physarum Simulation. Inspired by Sage Jenson's Procedural Art, this project implemented the evolution of Physarum networks by using some CG techniques including compute shader, GPU particles and volume raymarching. A brief introduction will be presented as below.
All Parameter in the simulation is editable.
Support up to 500,000 particles with the trail resolution of 256 * 256 * 256.
(My Device : GPU 1080Ti 11G, CPU Intel i7-8700)
Our system supports initilize the particle system through a texture.
As the image upon, the simulation contains 6 step.
- Particle Related
- SENSE: read the data from Trail map (Render Texture)
- ROTATE: update the particle velocity
- MOVE: update the particle position
- Trail Related
- DEPOSIT: change the Trail value according to the distrubution of particle
- DIFFUSE: 'Blur' the Trail map
- DECAY: Reduce the Trail value
ComputeBuffer, a List of ParticleInfo(particle position + particle velocity) For 2D: the z value is always zero. x,y repeat in [-Size,Size]
For 3D: x,y,z repeat in [-Size,Size]
For 2D: 2D Render Texture * 3 TrailRead/TrailWrite: two render texture for trail update Deposit : an additional render texture used in deposit step
For3D: 3D Render Texture * 3 The same as 2D
The GPU particle is used to visulize the cell. The implementation is similar to Robert-K's project. See the code in the project.
The trail texture is used as a main texture in a unlit shader. A LUT is added to exhibit the variation of the density. See the code
3D Trail's visulization is volume raymarching. It's basically a post-process effect, which used to visulize the 3D Trail render texture. See the code
[1]Physarum, Sage Jenson,(https://sagejenson.com/physarum)
[2]Physarum, Entagma, (https://entagma.com/physarum-slime-mold/)
[3]Characteristics of pattern formation and evolution in approximations of Physarum transport networks, Jeff Jones, 2011 (https://uwe-repository.worktribe.com/output/980579)
[4]GPU Particle, Robert-K(https://github.com/Robert-K/gpu-particles/blob/master)