Do you think it would be better to use the GPU (shaders) or the CPU to animate particles (positions) for this purpose? And, is it accurate to say that if I animate particles on the CPU end it’s easier to control them?
Animating in the CPU is usually inefficient. Not only does the CPU have to update each position one at a time (since JavaScript is single-threaded), but each time you update the vertex positions, the engine has to send all that new data to the GPU. That creates a performance bottleneck when you have thousands of particles to animate, and it becomes really resource-intensive when you’re doing it 60 times per second.
I recommend you perform your animations in the vertex shader to unlock the huge performance boost you get from the parallel-processing nature of the GPU. The only hurdle is that you’ll have to learn GLSL, the WebGL language to write shaders. I learned through https://thebookofshaders.com/ and it was an awesome resource. Plus, when you’re done you’ll know how to write shader code, which is a great skill to have!
Yea, I figured most experienced people would suggest the GPU and I agree because of exactly what you said.
That link you posted looks like it’ll be helpful. I know SOME things about programming shaders. I actually have a basic FBO particle setup that works, but the particles are static.