Magic Dust

August 2012 | By Mr.doob


Some months ago I was browsing and I realised that 95% of all the systems that supported WebGL also supported the extension OES_texture_float. This extension opens the door for textures with 32 bit float precision per channel instead of the usual unsigned 8 bit integer. This also allows all sorts of trickery. Suddenly you can store, say, 1 million particle positions into a 1024x1024 texture and in the vertex shader move the particles to wherever the color in the texture says. On top of that, add the generosity of zz85 on moving the particle simulation from javascript to a shader directly (aka fom the cpu to the gpu) and you end up with a neat and performant toy. I have to be honest though, I don't yet control the simulation code. It just happens to be stable and cool looking.

Built with: