How Would You Approach This?

I’m aiming to render convection clouds using particles. These are an example of the clouds I’m talkin’ about:

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?

Cross posting here:

@m1ke if you post on two forums can you link to the other posts you make? That prevents people from doing the work for you twice.

1 Like

Oh, I actually deleted that post on Stack Overflow because someone said it was “off topic”.

I changed this thread drastically since then anyway. I’m just trying to get opinions at this point before I move forward.

1 Like

Ah, I see. It’s not the same question I read earlier!
I would say it’s best to delete your post and make a new one if you completely change it.

1 Like

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 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.

Have you seen this?

I haven’t, but I will look into it more later. Thanks.