# Particle system AABB?

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

## Recommended Posts

Particle systems in my game can have the following properties (related to motion/position): size_life = size when particle is first created size_death = size when particle is about to be destroyed speed_min = minimum random speed speed_max = maximum random speed initial_direction (vector) = direction when particle is created spread (0-180) = initial_direction randomness - 0 degrees = all particles shooting in one direction, 180 degrees = particles shoot out in any direction gravity_direction (vector) = pretty obvious gravity_strength = also pretty obvious life_min = minimum possible random life of a particle life_max = maximum possible random life of a particle It is easy to determine the "radius" of a particle system (by radius I mean the maximum distance any particle could travel, assuming the initial direction is the same direction as gravity): half the diagonal of the quad "distance": (max( size_life, size_death ) * sqrt( .5 )) speed of particle "distance": (life_max * initial_speed) gravity "distance": (gravity_strength * (life_max + life_max * life_max) * 0.5) total: (max( size_life, size_death ) * sqrt( .5 )) + (life_max * initial_speed) + (gravity_strength * (life_max + life_max * life_max) * 0.5) That is the maximum distance a particle could possibly travel assuming it traveled in a straight path and only sped up due to gravity. However, that usually wouldn't happen, so that isn't a very good representation of the size of the particle system. So, is it reasonable to, and if so how would I, calculate the axis aligned bounding box of a particle system with these given parameters for the system? I'd have to combine all these into an equation/equations to determine the minimum and maximum x, y, and z that a particle could be. This sounds fairly... not fun... so is there a better way to estimate the bounding box?

##### Share on other sites
Unless you're doing some fancy GPGPU stuff, you already need to process each particle once per frame (or at least once per particle system update). I see no better way than to just get min/max coordinate values during this processing.

On x86 you can always try to speed this up with SSE using following intrinsics:

__m128 _mm_minps(__m128 a, __m128 b); // element-wise minimum, maps to MINPS SSE instruction
__m128 _mm_maxps(__m128 a, __m128 b); // element-wise maximum, maps to MAXPS SSE instruction

Both are original SSE instructions that should be supported on pretty much any CPU.

##### Share on other sites
Ah, good point, thanks. I suppose the radius could be used to test when a particle system would need to be updated (when the update could move particles into view), however since I'm using a quadtree and portal system then it doesn't really have much use I guess.

1. 1
2. 2
Rutin
24
3. 3
4. 4
JoeJ
18
5. 5

• 14
• 19
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631761
• Total Posts
3002177
×