Been working on this for a while. It’s a relatively simple idea:
- All particles simulate with a single compute shader and a single dispatch, no matter how many different emitters
- All particles draw with a single with a single shader
- Order-independent transparency (no sorting)
- Spawning done on the GPU
Then there are a few fairly basic bells and whistles like soft depth, simulation culling, draw culling etc.
In the demo the budget is 64k particles, but in practice it doesn’t care up to about a million particles
I’ve been working on a graph editor, as one does, since around 2016-ish, and this is probably the most useful usecase for it so far
I’ve had a node graph system in meep for a long while, and it has been deployed in a number of commercial projects over the years, so the core was very robust already.
We have things like node groups
nesting levels are arbitrary
The graph is compiled to custom a instruction set which then runs on a VM inside a compute shader.
There are a few clever tricks that make this VM run fast.
Since I had expertise with languages, I built a code optimizer for it as well
![]()
it’s not a massive deal, but it helps. And the cost is only paid during authoring.
Why a VM?
Compiling shaders takes time. On WebGPU - you can’t even cache, so you have to pay compile times every load. A particle effect with a dedicated shader can run ~4x faster than through a VM, but…
You have to compile that shader, and if you have, say 50 effects - you have to wait for 50 shaders to compile, with the VM it’s just one shader, and a very small one at that.
Still, the 4x seems like a lot. Until you consider that most particle effects have just a handful of particles in reality, and most of the performance is wasted on scheduling a dispatch, which for WebGPU (the browser) is even worse, because we have to encode dispatch on the main thread.
So in the end, I believe this is a good trade to make. In return you get infinite number of emitters supported, and you can even edit the simulation program on the fly.
The idea isn’t really mine, it’s been implemented more than a decade ago, but mainly for prototyping particle effects, not for production. The logic back then was basically the same - you can run the VM fast-enough, and you don’t have to pay for compile.
I took it a bit further, to get a fully GPU-driven particle system



