Skip to content

SilverSpace505/gpu-life

Repository files navigation

banner

GPU Life

A little simulation of particle life made using webgpu and typescript.

The algortihm for the particle movement is entirely based of particle life. It's just been moved onto a compute shader to allow for larger numbers of particles.

The movement of the particles is done using 2 ping pong buffers going through a compute shader. Then the rendering is done using a basic vertex and fragment shader each frame.

There are 3 engines that change how the particles are managed:

  • NSquared - each particle checks every other particle, this is highly inefficient.
  • Atomic Linked Lists - particles are put into cells, where they are added to lists, then each particle can only check other particles in nearby cells to improve performance in larger environments.
  • Counting Sort - once particles are put into cells, the array that stores their cell ids are sorted directly. This approach results in faster reading of nearby particles, at the cost of a slower construction time.

About

A little simulation of particle life made using webgpu and typescript

Topics

Resources

License

Stars

Watchers

Forks