WebGL: 80.000 particles
minimal.be
minimal.be
http://www.iamnop.com/particles-mrt/
(it's a little unstable since it uses WEBGL_draw_buffers)
EDIT: Seems that http://threejs.org/examples/#webgl_buffergeometry_particles has 500k.
http://www.indiegamejam.com/igj0/
Those guys all interacted with each other and the environment (though the engine was designed to do the interactions in slices, where 1/N of the guys would be checked each frame, but N was not high, like 4 or 5 maybe?)
Keep in mind this was all on computers from the year 2002, which were pretty damn slow compared to computers today. Today you could do a lot of guys.
I'm assuming they all still moved, and the checking was just for change-of-independent-behaviour-pattern?
Both tests use simple 3D shape particles (5-vertex diamonds) and hardware-instanced rendering (instanced_arrays extension), the first updates particle positions on the CPU, the second on the GPU (fragment shader writes particle position to offscreen render target, which is then sampled in vertex shader to displace particle positions).
The first (CPU updates) goes up to around 450k particles on my Windows7 desktop machine before consistently dropping below 16ms per frame, the second (GPU updates) goes to about 800k particles before dropping below 60fps:
http://floooh.github.io/oryol/Instancing.html
http://floooh.github.io/oryol/GPUParticles.html
These numbers are not much different then using desktop GL (2.1 with extensions). The real advantages for this type of scenario would come from updating persistently mapped buffers which are not available in WebGL.
What's impressive is the raw math performance of asm.js, the particle update loop is simple glm code (https://github.com/g-truc/glm) without any fancy optimizations.
I continue to be staggered at how well asm.js performs, and really glad Chrome has taken on optimising for it as well as Firefox.
So, even though there's no official support for asm.js on mobile safari. It still works surprisingly well!
http://floooh.github.io/oryol/DrawCallPerf.html
This is one uniform update and one draw call per particle in a loop.
Unfortunately draw call overhead on WebGL is really bad compared to desktop GL. On my Windows7/nvidia setup I can go up to about 75k draw calls before frame rate drops below 60fps, on other platforms it's worse. So in this particular (very simple) scenario, hardware instancing actually pays off.
For quad particle systems it is indeed usually better to just directly write the vertices to a dynamic buffer instead of instancing, but I don't have a demo (yet) for this particular case :)
I'd be curious to see your comparison over non instanced/single draw call though. I threw the adapter code I wrote for my instanced version up here if it helps: http://pastebin.com/1gjvreBs
[1]: https://www.chromeexperiments.com/experiment/magic-dust
[2]: https://www.chromeexperiments.com/experiment/one-million-par...
https://www.chromeexperiments.com/experiment/one-million-par...
It does its calculations on the GPU so it can handle a million particles easily. You can also pause it to explore it in 3D.
Interesting how this all WebGL stuff is still so "hacky" and not yet commonly used all around .
Not everyone is using iOS 8 and Chrome blacklists lots of Android handsets, and lets not forget about other mobile OSes.
I also assume you also checked Android Auto and TVs regarding WebGL support.
That just happens every three years, and we don't have to do anything about that.
We have 100,000 users who have created +180,000 scenes using advanced WebGL and it is really stable: http://clara.io.
Here is a new demo scene I've been working on. PBR materials (w/ clear coat), area lights, HDR, bloom, DOF and FXAA:
https://clara.io/view/d3b82831-d56b-462f-b30c-500ea1c7f870/w...
And you can edit any part of the mesh or materials or animation or lighting in our editor.
I could play with this for hours. :)
gl.enable(gl.BLEND); ... gl.blendFunc(gl.SRC_ALPHA, gl.ONE);
It basically means that the particle color is added on top of the already rendered particles (with the alpha value used to modulate the particle color, which is a bit strange, it would be more usual to use gl.ONE for both parameters). The more particles overlap, the brighter that pixels becomes.
Details are explained here: https://www.opengl.org/wiki/Blending#Blend_Equations
A description like "80k dynamic interactive physics based particles" would do this one more justice.
(There's a dynamic particles demo in the threejs examples too, though it doesn't say how many there are...)
If anyone has some good articles about how to render a large number of dynamic particles, where the simulation happens on the CPU (i.e. it's not all shader trickery), using modernish OpenGL (no fixed function stuff), please share. I'm eager to learn more about it, but haven't found good resources. It's a blocking issue towards my goal of creating a bullet hell shoot-em-up game.
I found this blog post very useful: http://hacksoflife.blogspot.de/2012/04/beyond-glmapbuffer.ht...
If you can afford to target bleeding edge OpenGL, the AZDO slides contain the current state of the art (there's a whole section about dynamic buffer updates somewhere in there): http://www.slideshare.net/CassEveritt/approaching-zero-drive...
On WebGL, the established tricks like buffer orphaning don't work, and direct mapping isn't available. It seems best to simply do a bufferSubData and not care about double buffering etc (https://groups.google.com/forum/#!searchin/webgl-dev-list/fl...)
Also, If I open developer console in Chrome (docked at the bottom), it seems the mouse position is off like 100 pixels or so.
If a particle ever reaches the exact mouse coordinates, its position is randomly generated anywhere on the screen.
When rendering the particles, it simply draws a line between the previous and the new position. So when a particle is transported to a random place, it create the rays that appear around the cursor.
There's no real complexity in the maths involved, but I remember spending quite some time tweaking the random ranges to get something nice.
Yours is a very fun demo. I tried modifying it to move more work to the GPU. I had the CPU only update a subset of the particles each frame and the GPU would interpolate a curve to fill in the missing frame updates. It sorta worked. It was N-times faster and could do more particles. But, the interpolated curves were progressively less responsive and fun.
'attack of the killer swarm' one of the first round of games out of experimental gameplay project