My question is a bit weird, but I figured by posting it in this section there’s a higher chance someone will be able to help.
I’m building from scratch kind of a Custom Particle System using the C# Job System, it still needs a lot of optimization but right now the biggest bottleneck seems to be handling dead particles. I ran a very simple benchmark and comparison with Shuriken, 50000 particles, destroying and re-emitting about 300 per frame, and had these results:
My System – just simulation: 150 fps
My System – destroying particles: 50 fps
Shuriken – with any number of dying particles: 190 fps
My approach for dead particles is, during the Update Job, I save the dead IDs into a NativeQueue<>.Concurrent and then sort the particle array (alive ones at start, dead at the end) in the main thread, before Rendering.
I was wondering what is the approach used in Shuriken? Looks like there is no performance impact when many particles die at the same time. Is the full array sent to the GPU along with the state of the particles and the shader filters the dead ones?
Kind of a separate question…. Right now I use a custom shader, but what would I need to do, to use the existing Unity Particle Shaders? Is there some documentation/tutorial somewhere that describes how to draw custom geometry with the standard Particle Shaders, what are the required buffers or streams?