Hello everyone,
I have a project in mind that involved a simple particle system moving in a force field on a Raspberry PI 3+.
The particle class would be really simple. It would just consist of applying the relevant force from the forcefield based on the particle position (no collision check) and then compute speed and position as usual. I think a small pseudo-code section is better than a long explanation:
class Particle {
PVector pos, vel, acc;
float maxSpeed;
...
void update() {
acc.add(forceAt((int)pos.x, (int)pos.y)); // Based on the forcefield
vel.add(acc);
vel.limit(maxSpeed);
pos.add(vel);
}
...
}
The issue is that I want to be able to display quite a lot of particles on the screen and I don’t know what is the most efficient way.
From the tests I have done so far on my computer, I can manage about 4000 particles maximum before the framerate start to decrease and offer a sloppy result. So, on a raspberry PI it will probably be quite a lower number.
Then I thought that maybe I could use the GPU to compute that particle system but I have no knowledge in that area and that’s why I would need guidance.
FIrst I don’t really know if it is at all do-able. I have read that you could use the GPU with OpenCL on a raspberry PI 3+ but I don’t know if it would make sense with what I want to do.
Also, I’m not even sure that it would allow me to really improve the efficiency of the particle system. After all it is still “just” a raspberry, not a high end GPU card.
And maybe processing is not even the right tool for that…
What do you think?
Thank you =)