Wow, that's awesome. if you don't let the particles catch up w/ your mouse (and trace circles around them) the gather up in one place and turn white, resulting in some spectacular 'explosions'
If you let them catch up, you can make a sort of pink torus around the mouse.
If you move it steady in a vertical line it creates two lines that looks like they were smashing against each other.
I actually think this could become a game; maybe you show the player a pattern and then he tries to recreate it... or something among those lines.
Works absolutely flawlessly in Chrome, impressive stuff. Can't wait to see a company like Blizzard release a HTML5 MMO in a few years time (it'll definitely happen). Imagine a game like Diablo 3 in HTML5? Wow.
Having the GPU compute position updates into a texture would indeed be orders of magnitude faster, but it would require the vertex shader to read from a texture to get the results. Unfortunately, vertex texturing is an extension that is not required in the WebGL standard and not supported on a significant percentage of machines. It's almost a shame that vertex texturing makes really fun demos really easy to make. Eve…
No need to read the texture in the vertex shader. Render to a buffer object and use that as your vertex array. But broadly yes: that's the problem with OpenGL support, and WebGL in particular is still very bleeding edge. I'd be pretty surprised if vertex texture fetch wasn't supported though. It works on basically all hardware from the PVR SGX on up. Unified shaders are pervasive on both phones and desktops. I did fi…
> Render to a buffer object and use that as your vertex array.
I don't think that's an option in ES2 or WebGL. I'd love to be proven wrong!
No need to read the texture in the vertex shader. Render to a buffer object and use that as your vertex array. But broadly yes: that's the problem with OpenGL support, and WebGL in particular is still very bleeding edge. I'd be pretty surprised if vertex texture fetch wasn't supported though. It works on basically all hardware from the PVR SGX on up. Unified shaders are pervasive on both phones and desktops. I did fi…
> Render to a buffer object and use that as your vertex array. I don't think that's an option in ES2 or WebGL. I'd love to be proven wrong!
FBOs are absolutely part of ES2, and thus presumably an official part of WebGL. I've used them in embedded contexts, but never in a browser. And as always, this is on the bleeding edge of what the drivers are prepared for, so dragons may lurk. But at least in principle it should work.
> Render to a buffer object and use that as your vertex array. I don't think that's an option in ES2 or WebGL. I'd love to be proven wrong!
FBOs are absolutely part of ES2, and thus presumably an official part of WebGL. I've used them in embedded contexts, but never in a browser. And as always, this is on the bleeding edge of what the drivers are prepared for, so dragons may lurk. But at least in principle it should work.
I've seen talk of CPU-less render-to-vertexbuffer dating back to 2004, but I've never dug into how to actually do it until now. From what I can dig out, it requires PBOs which are not available in ES2. I guess copying back and forth over the bus via gl.bufferData(ARRAY_BUFFER, gl.readPixels(...), gl.STREAM_DRAW)) is still better than doing the math in JS. I might have to try combining the glReadPixels with the mapped buffer extension that is available on the iPhone P:
I used particles pretty heavily in my (inneficient) WebGL game Up and Above: http://littlesquareblock.com/upandabove It's not nearly as efficient as this demo, but it's at least a game. There are at least a dozen areas I could fix up to prevent the GC from going nuts if I was so inclined, but it works fine for most people.
Pretty neat game. WebGL is still a little clunky on Linux but I was still getting a playable framerate (but just barely).
Seem to work well here (under Arch Linux, Chrome dev channel, nVidia proprietary drivers)
It looks very impressive. I'd love to see some kind of game using particles like that, something like Osmos: http://www.youtube.com/watch?v=pso6UBicLWU
For what it's worth, I wrote a simplistic Osmos clone last year using 2D canvas drawing (not WebGL). It's fairly inefficient, but anyone's welcome to hack on it and make something cool with it. http://stepheneisenhauer.com/demos/browsmos/
Well you can render many spheres with tiled rendering.