Hello everyone!
I am looking for advice on a project : I am simulating a few thousands of microorganisms (microalgae). I need to simulate the physics for each of them, applying three forces : fluid friction which limits velocity; collision, or rather repulsion based on distance; and a random force to deviate trajectories a bit and make it look like brownian movements.
I took a look at a few basic Particle System examples, I adapted the ParticleSystemPShape example in Topics/Create Shapes, but the frameRate drops with the number of particles I am generating. Even when I am not updating the physics, simply calling shape(shapegroup) on the shape of type GROUP that contains all the child shapes, I get a low framerate…
I also took a look at the PixelFlow library by Thomas Diewald, but all the Particle System examples show plain ellipse shapes (in need textured quads), and besides I tried diving into the source code and reference but it is couldn’t quite figure how and if I could adapt it to suit my needs.
So my question would be : does anyone know of an efficient way to update and display multiple quad shapes?
I have been coding fragment shaders lately, and I guess shaders would probably be a good way to make all this more efficient.
If anyone has tips, example projects, that would be very helpful!
I’m not sure what you mean by quad shapes. Can you clarify? I’ve worked in 3-d programs with quads and tesselations and such, but it sounds like you want a 2-d simulation and I’m not sure how that might apply.
I’m not sure it will be up to your needs, but I’ve done simulations with up to 2040 objects. It throws an “assertion error” at 2048 objects. It’s been a few years since I tried, but I haven’t been able to find my way around that limit. There have been a few minor updates to Fisica, but the system doesn’t seem to be in active development. Take a look at the examples to see if it might be of use.
Thank you for suggesting Fisica, unfortunately 2048 particles is not enough for my project…
I ended up doing this the basic way, still doing all the physics computation in the CPU, I got about 8000 at 25fps… So I am still looking for a shader way to optimise all this and get more particles, but for now I get by