GPU Particle Synchronization System

General / 21 June 2021

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:

  1. 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)

  2. Grouping map: A mini system through shader to control grouping behaviors of particles.

    grouping map modifying demonstration  

    process of making grouping map in hlsl shader

  3. 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

https://www.nationalgeographic.com/animals/article/watch-how-mexican-fireflies-synchronize-light-shows