I’ve been working on a GPU Particle System that does NOT require compute shader and can run on Android, iOS, PC, Mac and WebGL. So far, I have a bunch of features implemented and ready to go. Other features are more tricky to implement and /or need fixing. Here’s what I got so far:
Emitters:
Emitters are very close to Unity’s Shuriken Particle System and offers lots of variety: Point, Edge, Circle, Hemi sphere, Sphere, Box & Mesh.
Particles:
The type of the particle can also be defined simply by choosing from a drop down list, just like any other particle System. Additionally, you can choose to display particles as points. This is particularly usefull, when working with millions of particles, because billboards might just be too big. Particle types: Point, Triangle, Billboard, Horizontal billboard, Vertical Billboard, Stretched Billboard, Tail stretched billboard & Mesh.
Attractors and forces:
A couple of froces and attractors have been implemented: Directional Force, Circular Force, Drag & Turbulence
Turbulence:
No particle system is complete without turbulence, that’s why I implemented Vector Fields (from FGA files) and classic Perlin turbulence noise. Vector fields are only supported on devices that support 3D textures, though.
What it is good for:
This particle system is very good at displaying large amounts of particles. In order to function properly, it should be loaded with the level, and must be properly pooled. Instantiating and Destroying will ruin your performance. Environment effects like snow or rain are perfect cases for this system. Also magic and sparks effects can be spiced up with this system. I would suggest to reuse the same particle system every frame like so: Emit → Move to new position → Emit → Move to new position → Emit → etc. On mobile devices, the fill rate is the biggest concern. That means, that particles should have a small size to reduce overdraw.
How it works:
This GPU particle System uses a technology, used already many years ago. You can find lots of papers about this on the internet. On Initialization, this system generates a mesh of particles, and some buffers for position, velocity and meta data. Those buffers are simple RenderTextures. On every update, the velocity buffer is rendered into the position buffer with a shader, using Graphics.Blit(). The same happens to all other buffers with different shaders. Finaly, when rendering the Particles, the shader reads the position information from the position buffer and updates its position. Since all heavy calculations are done simultaniously on the GPU, it is possible to calculate millions of particles and also render the particles many times per second. Shader keywords enable and disable features based on target platform and required features.
I successfully tested this system with 6.000.000 particles at 30 FPS on a GTX 970 in the Editor. On a shield tablet, I got to around 200.000 particles.
Check out the realtime effects here (HDR) and here (Mobile)
Asset Store Release
Initially, I was contemplating to put the Particle System on Git or the Asset Store for free. But knowing myself, I would probably just drop it as soon as it’s out. To give me a bit of an incentive, I’ve come to the conclusion, to sell it on the Asset Store, since there are still so many more features, that I’d like to add in the future. Im going to start with a Beta phase in which Im going to give a good discount: 60% = 20.00 USD.
The GIFs are captured from the HDR Demo so make sure to check it out yourself! (for link see above)
I cant wait to hear your feedback.
Cheers!
Max