4 ms·
I was expecting the particles to be done as a pure shader implementation, but when I looked at the source that's not the case. While a vertex shader is used to
by Udo 12y ago
I was expecting the particles to be done as a pure shader implementation, but when I looked at the source that's not the case. While a vertex shader is used to display the particles, the "physics" is done in a JavaScript loop.
- boblemarin 12y agoExactly, there's not much optimisation in there. In fact, it was my first try with WebGL.
- pierrec 12y agoThis also surprised me. You can do the exact same thing, but with millions of particles, if you store and process them on the GPU. The first example of that technique being used in WebGL is probably by Mr.doob [1]. Since then, there have been many iterations, some of which are basically a cooler version of the linked demo [2]. (And simpler, judging from the source!) [1]: https://www.chromeexperiments.com/experiment/magic-dust https://www.chromeexperiments.com/experiment/magic-dust [2]: https://www.chromeexperiments.com/experiment/one-million-particles https://www.chromeexperiments.com/experiment/one-million-par...