Skip to content

Particles

Alex Miyamoto edited this page Apr 23, 2018 · 2 revisions

The particle system was designed prioritizing performance. On the previous title the CPU overhead of the middleware particles we were using was too high, time was spent optimizing when to switch off effects and at what distance to draw them. Usagi's particle system was designed to be light-weight enough to never have to allocate programmer resources to optimizing individual effects rather than the system.

This was accomplished by only exposing what could be updated on the GPU rather than the CPU. Vertex data is created once, when a particle is spawned, no update occurs on the CPU.
Each particle is represented by a single vertex in the vertex buffer, with all the data necessary for to calculate per frame values over the life of the particle.
Vertex shaders are used to pass through parameters to the geometry shaders, calculating the current colour, size and postion. The geometry shader generates the geometry for each particle.

One exception to the design was the option for CPU update of physics - the GPU implementation of drag could sometimes tend to odd motion. Certain effects with long lived particles influenced by gravity enabled this option. Animating flipbooks also takes place on the CPU.