Website powered by

Real-Time GPU Boid Simulation System - Unity

Real-Time GPU Boid Simulation System - Unity

The boids algorithm is something I have been wanting to try out for a long time. It seems to simple yet elegant. And it is a perfect fit to try and run on the GPU. In this project I showcase my own implementation of the algorithm in an underwater environment. The fish are being simulated and rendered entirely on the GPU and are therefore very performant. Currently my system can handle a couple thousands of boids while staying above 60 FPS.
-------
I have also combined the fish simulation with my previous kelp simulation so they can interact with each other. To do that I took inspiration from a GDC talk from the God Of War developers on their wind and foliage system. All fish are being rendered to a low-resolution 3d texture which represents the volume in front of the camera. This texture is then sampled in the kelp compute shader as a collision scene. This makes it possible for every single fish to interact with the kelp at a manageable performance cost.