Skip to content

A little simulation of particle life made using webgpu and typescript

Notifications You must be signed in to change notification settings

d1favero/gpu-life

 
 

Repository files navigation

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 61.7%
  • WGSL 34.2%
  • CSS 3.0%
  • HTML 1.1%