Untiy3D Implementation of flock simulation, GPU Powered.
Implementation Details:
Computation happens on the GPU using ComputeShaders, then the buffer with data is set in another SurfaceShader that calculates the view matrix for each boid -flock handled as a big mesh-, they're then rendered on the screen, thus eliminating the overhead of recieving the data from the GPU buffer to the CPU and drawing them again.
How to Run:
Start the sample scene Scenes/BasicFlocking and hit play.
Tweak the parameters of BasicFlockController to control the general behaviour of boids.
Unity Version:
- 2018.3.9f1
ToDo Features:
- Add Predation Behaviour (Some boids will act as a predator, seek to hunt other boids)
- Add Flee Behaviour (Boids will run away from predators)
- Add different ranges for each behaviour.
- Add Boid Specific Skinned Animation.
-
Add Collision Avoidance (Boids will avoid collisions around the scene, will probably be baked static colliders)Collision Avoidance won't be feasible for the general purpose of the whole system!
Inspired by: