Thomas Denis : Sketch #38

Hey guys :wave:

Last weekend I made a small particle system that runs fully on the GPU in Unity, there are only a few features at the moment, but I thought it’d be a great experience to try to build something with it while adding new stuff at the same time! ( what could go wrong? :sweat_smile: )

Here are already a few updates on the past couple of days…

GPUParticles_Light

What I got over the weekend, here simulating around 10k particles I think, I can push it to 1M easily but you start to wonder why the heck would you need that many particles. :smile:

I’m making a single draw call using DrawProcedural, specifying how many verts I want, then in the shader I recreate the billboards using a geometry shader. I still have to try using a DrawInstancedIndirect and feeding it a quad mesh directly, it might be faster than a GS.

GPUParticles_Plexus_Light

This is what I came up with yesterday. The particles are updated in a compute shader so I have access to the other particles of the buffer while I’m updating one. Here I check the whole buffer to find the closest points to each particle, and then build extra quads for each connection to the closest, the same way I build the billboard quad in the geometry shader. If there are enough neighbors around I also build an extra triangle using the particle position and two close neighbors positions.

Next step is to combine multiple emitters and try to make something cool with it :grin:

19 Likes

Really nice, man
Good luck!

1 Like

Nice stuff !
Can’t wait to see the final result :smiley:

1 Like

Trying to combine both emitter types. Looks promising, next steps I think will be implementing a module similar to shuriken’s velocity over lifetime, I don’t have a lot of options to make the particles rotate right now ( besides faking it with the noise ).

I also want to input gradients for some parameters like the color over lifetime ( right now its just a star and end color ), I’ll see if I just send the gradients keys for each parameter and sample the gradients in the shader, or if I bake them all to a texture where each gradient parameter would be a row in the texture, and just sample this texture once.

5 Likes

Procrastinating a bit today by adding sub-emitters :grin:
Whenever my compute instance has a parent, it’ll grab its parent’s particles buffer at the start, and offset the spawn points by the particles positions

Annotation 2020-10-11 160905

Also added the gradients ( baking them to a texture right now ).

1 Like