Summery: a fireflies inspired GPU particle synchronization Engine for Teamlab worldwide exhibitions which can also be adapted to simulate other grouping behaviors.
I created a high performance firefly simulation system: adapted synchronization math and coupling behavior in compute shader. Efficient pipeline assures million fireflies interact with sound and human motion seamlessly for giant projection setups in San Francisco, Miami, Tokyo and Shanghai etc.
System written in C#, compute shader, hlsl in Unity.
Features:
-
Synchronization patterns: creates desired syncing modes by simple parameters adjustment.
(drastic full-range coupling)
(fast spiral coupling)
(fruit flies coupling)
(noise tornado coupling)
(far range natural coupling)
-
Grouping map: A mini system through shader to control grouping behaviors of particles.
process of making grouping map in hlsl shader
-
Secondary sync map control: An interactive layer on top of synchronization system to control sync range and spreading speed.
A: Interactive coupling map
B: Base Kuramoto synchronization layer
A+B: Coupling map controlled sychronization
Kuramoto synchronization algorithm in pseudo code:
If (within coupling range) For 0 -> N phaseInRad = phaseBuffer[index] * PI * 2; sumInXAxis += cos(phase); sumInYAxis += sin(phase); num ++; note: R = square root of sumInX / num and sumInY / num ψ = angular value of sum in x and y (atan2)
Kuramoto Synchronization close-up
Resources:
https://en.wikipedia.org/wiki/Kuramoto_model
http://go.owu.edu/~physics/StudentResearch/2005/BryanDaniels/intro.html