• Advertisement
Sign in to follow this  

Particle System

This topic is 4040 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I wanna add a particle system to my engine, but I'm not sure about some things. Let's say I have an array of particles and an array of forces (attractors, repulsors - like a black hole for example, and directional forces). For the directional forces is easy, just add the directional vectors, but for the others... How can I compute the velocity of a particle per frame related to a attractor/repulsor (the far particles should be affected less) without having to find out the distance between each particle and each force generator each frame? If I do that I'm sure the frame rate will really drop...

Share this post


Link to post
Share on other sites
Advertisement
In short, you can't. There are some optimizations, but they come at the cost of memory or accuracy. You could divide the space up into lots of sub-regions and precompute a total force in each sub-region. Then at run-time, you do a lookup based on the particle's position. Also, keep in mind that forces such as gravity are proportional to the square of the distance, which means that no square-root computation is necessary.

You should just try it using brute force. My prediction is that unless you have a lot of forces and/or a lot of particles, you won't see much of a slow down.

Share this post


Link to post
Share on other sites
Unless super-accurate physics was required and a 'good-enough' solution wasn't good enough, couldn't you just update a portion of the particles per-frame?

Meaning you check say 1/3rd of the particles per frame, but when the particles are updated use 3x the attractor/repulsor force? The effect would be that the particles would be just slightly off a physics-accurate position, but unless they were moving really fast I can't see it affecting it...

Just food for thought. I'm no particle system expert and haven't done any real implementation stuff on it yet.

[Edited by - ItsDoh on January 28, 2007 2:06:03 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement