GPU Particles
Particles can give a lot of visual feedback, but having many particles can quickly become a drain on resources, that's why I decided to create and simulate particles on the GPU. Simulating particles on the GPU also unlocks new resources that are not available on the CPU which allows for more complex, and impressive, behaviours.
To set the stage, the TRK-engine used a particle system that handled creation, simulation and sorting on the CPU side, this put a hard limit on how many particles were feasible to use without impacting the performance. While it is possible to optimize to a large extent, having to rely on the CPU is a quick bottleneck. That is where the GPU and its structure becomes a natural chose. While normal CPUs are limited to around 8 - 32 threads graphics cards often have in the thousands. This makes efficient multi threading for simulation and sorting of millions of particles much more efficient.
Compute shaders are the big step to utilise the graphics card for our own purposes, and so that is where most of the work is done.
Because the simulation is performed on the graphics card, textures containing world information can be sampled to improve effects of the simulation. One method used for my simulation is