A 3D Particle System with Sinusoidal and Flocking Behavior in a Moving 3D Noise Field

Song: Asaf Avidan - One day / Reckoning Song (Wankelmut Remix)
Github: github.com/Jeloi/flocking

In this project my initial goal was to create a 3D particle system with agents (boids) that exhibited flocking behavior. I started by understanding Craig Reynold's flocking algorithm, in which "boids" follow three rules of flocking: separation, alignment, and cohesion. These were basically just rules for forces that act on each boids' velocity. Once I got a nice 3D particle system up and running, I started to experiment with my own rules for forces.
Because I was really interested in the concept of noise, I had a force be applied to boids based off their 3D position in a noise field, with an offset that is constantly moving. Because of the nature of noise, nearby points have a similar noise value, so this implemented a type of pseudo-flocking behavior.
The only real flocking rule that I ended up using was cohesion, which basically means each boid looks at its neighbors (neighbor distance being a variable i control), and a force is applied to the boid to tend toward the avg position of the neighbors.
Viscosity is a force that just slows the boid's down by applying a factor of the inverse of velocity.
I also applied a force that I called centering which causes boid's to tend toward the global average of all boids' positions. As the camera is pointed at this global average, the point the camera points to is always the center of the flock.
One challenge I had was that I felt the artwork would devolve too quickly into a a messy blur of points heavily concentrated around the center, with the noise movements being less defined and interesting. I attempted to address this problem of the piece not having much "perpetual action" by making the weight of the centering force be a function of a sinusoidal function. After tweaking with the variables a ton, I was able to achieve a nice oscillating effect that makes the piece much more perpetual.