Particle Editor

Background

During the development of Spite: The Drained Hollows, I created a simple particle editor for our technical artists.
In the course of that, I decided to get more involved with tools. I'd never had a more satisfying feeling with anything I'd produced before. The tools I had made were very simple, but the artists still made something out of them. The gif below is the one I got from our technical artists.

Goal

My goal for this project was to have as many paricles as possible in a scene without dropping below 60 frames per second. I also wanted to include several different movement patterns.

Compute Shader

I had only heard of the term compute shading before. At first I was sceptical about trying it out, not knowing how time-consuming it would be for me to learn. After some research in the field, I found that most recommendations tended towards implementing compute shading.

By shifting the workload from the CPU, the calculations and updating of the particles, to the GPU, I was able to gain a lot of performance, about 40% more particles could exist simultaneously. The second performance boost came from handling 256 threads per thread group, which allowed the emitter to reach over a million particles.

Result

I managed to render three million particles simultaneously while keeping the frame rate well above 100. This was a great success for me, as I learned how to create particles without a geometric shader. I was also able to work with threads on the GPU. Although I only used a one-dimensional thread group, I was able to expand my knowledge.

Reflections

I did end up overscoping the assigment, where most of the fluff and extra features had to be scraped early in the proccess. This was the toughest decision I had to make during the process, since it narrowed the project down to basically being mostly about getting a high amount of particles present at the same time. 

If I could do one thing different looking back, it would be to stop optimization when I reaced one milion particles and use the remaining time to add more customization options for the emitter.


©2022 by Alexander Maier