finding minimum velocity of a particle system

   8383   7   2
User Avatar
Member
63 posts
Joined: July 2005
Offline
Hello,

I have a particle system that has around 2000 particles in it. I am trying to find the particles in the system that have the minimum velocity of X,Y, and Z and return those minimum velocity values.

Is this possible to find?

-jon
User Avatar
Member
7025 posts
Joined: July 2005
Offline
Do you want this over the whole animation or just per frame?
User Avatar
Member
63 posts
Joined: July 2005
Offline
over the whole animation would be great. How hard is it to figure this out between the whole animation or per frame?
User Avatar
Member
7025 posts
Joined: July 2005
Offline
There are several ways to do it. Personally, I'd use VEX, and accumulate an attribute that holds the ID of the slowest particle. Then at the end you'd know which one is slowest.

Alternatively, you can read in the whole particle sim into CHOPs (Geometry CHOP using the “v” attribute) and you could see it visually.

What's the ultimate use? When you say “return” where does the min value get used? If you're worried about slow particle, just use a Speedlimit POP )
User Avatar
Member
63 posts
Joined: July 2005
Offline
I am rendering out a velocity pass for motion blur in post. Here is how I am doing it (let me know if there is an easier way to do this, please!):

The particles are copied to metaballs, then using the point SOP i change the color of the metaballs to the velocity of the particles, thus visually representing the particles' color as its velocity. However, if the velocity is negative (my particle system contains particles with both postitive and negative velocity values) then the metaball will render out as black, which is not good.

But once I find the minimum velocity value, which will be negative, then I add the positive of this value to itself to equal 0, then divide by itself times 2, which will change all of those velocity colors to values between 0 and 1. (For example if the minimum velocity for x was -3, then entered into the function would be similar to ((-3+3)/6) .) This is all done in the attributecreate sop.

Then useing a vex_constant with its color overridden by the attributecreate, the resulting render will be that of flat colored metaballs representing velocity. I do have to thank my friend Matthew Parrott for helping me get this far.

But again, if there is an easier way, lemme know!

I think I will try the CHOPs, method, as I will be able to see it very quickly and I only need it once.

-jon
User Avatar
Member
11 posts
Joined: July 2005
Offline
How about offsetting all values by something large such as ‘1000’ for all velocities and rendering in floating point precision. This would avoid the trouble of needing the 0 to 1 range, add higher precision… would take a bit more disc space etc., but would be simplest way I guess.

Jens
User Avatar
Member
63 posts
Joined: July 2005
Offline
Thanks Peter! The CHOPS method definately worked. By the way, watching the velocity change graphically like that visually was one of the coolest things I have ever seen!

-jon
User Avatar
Member
7714 posts
Joined: July 2005
Offline
Two suggestions to try off the top of my head:
- abs($VX) if you're only using one component, else
- use vlength($VX,$VY,VZ)
  • Quick Links