Skip to content

Visualize 3D simulation of a large shoal of fish.

Notifications You must be signed in to change notification settings

macinn/CUDA-Boiding

Repository files navigation

Shoal-of-fish

Abstracct

Visualize 3D simulation of a large shoal of fish.

Description

CPU and GPU-based boiding simulation, rendered using OpenGL.

Boids algorithm

As with most artificial life simulations, Boids is an example of emergent behavior; that is, the complexity of Boids arises from the interaction of individual agents adhering to a set of simple rules. The rules applied in the simplest Boids world are as follows:

-separation: steer to avoid crowding local flockmates

-alignment: steer towards the average heading of local flockmates

-cohesion: steer to move towards the average position (center of mass) of local flockmates

GPU Implementation

Spatial hashing was implemented to omit a major bottleneck-random memory access looking for nearby flockmates. Start/end indicies array were used to allow constant time access to given cell. Entire informatation about boids, i.e. position and valocity is stored on the GPU side. Data to OpenGl is directly transfered using CUDA buffers. Boids are simulated in a one CUDA thread - one boid manner.

Examples

image

image

image