4 ms·
I've been playing with webGL particles and I'm surprised that texture upload is chosen over normal attribute arrays. I'll have to try it out and see if its fas
by willvarfar 13y ago
I've been playing with webGL particles and I'm surprised that texture upload is chosen over normal attribute arrays. I'll have to try it out and see if its faster.
I've found it best to not update anything if you can help it, so use procedurally generated particle effects.
For example, to follow the mouse, I'd be passing in a smoothed curve the mouse has recently travelled down as uniforms. This doesn't work the same way, and won't give as exact results, but does look nice.
One of my blog posts, related: http://williamedwardscoder.tumblr.com/post/43800948133/efficient-procedural-flame-particle-effects http://williamedwardscoder.tumblr.com/post/43800948133/effic...
More recently I've been doing effects using Perlin Noise at an extra dimension - time - and that works great for stuff like plasma effects that don't have to react with the environment. http://williamedwardscoder.tumblr.com/post/57181055984/perlin-noise http://williamedwardscoder.tumblr.com/post/57181055984/perli...
- kevingadd 13y agoTexture upload is a great choice because it means your particle update routine can be a pixel shader that you run the current 'state' texture through to produce a new 'state' texture. Then you're literally running the whole thing on-GPU. Not aware of ways to do that at present with DX9-class hardware or with the WebGL feature set. Modern desktop GL and DirectX let you write to and read from basically anything, as I understand it.
- exDM69 13y ago> Texture upload is a great choice because it means your particle update routine can be a pixel shader that you run the current 'state' texture through to produce a new 'state' texture. Yep. This is how GPGPU programs were done some 10 years ago when there was no API to deal with GPU buffers in a more flexible way. These days we've got Transform Feedback (aka. Stream Out in D3D) and Compute Shaders that are more flexible. And Cuda and OpenCL, of course. One thing you should be aware of when doing this kind of texture-to-texture GPGPU is that the internal GPU pipeline in GLES2 (and thus, WebGL) may be less than full 32 bit floating point. Also the texture formats being used are not full floats. So watch out for numerical precision issues!