View Full Version : Drive particles rotation with fluid velocity

 djhush10 October 2009, 03:25 PMHi guys. I'm doing a snowburstsimulation and I'm driving the particles with a fluidcontainer. I need to think of a way to make the particle rotation being driven by the fluid velocity, but right now my minds totally blank, do you have any ideas? Thanks //Anders
AndersEgleus
10 October 2009, 07:22 PM
What kind of rotation (i.e. what kind of particles are you using - instances, cloud, sprites)?

A Common method in fluid dynamics is to use the curl of a velocity field to get a representation of the field's rotation at any point. You can get the curl using the following equation:

V (x, y, z) = (dPz/dy – dPy/dz, dPx/dz – dPz/dx, dPy/dx – dPx/dy)

Where V is the curl and P is the velocity field. dPz/dy etc are partial derivatives which you can get by sampling the velocity field at different points around the particle and then dividing by the distance between the sample points. E.g. to get dPz/dy, sample the fluid velocity's z component one half voxelsize above the particle and then one half voxelsize below, and then divide by the voxelsize. The curl can then be used as a vector-angle rotation.

The reason why I'm not getting into great detail on this method (how to implement it in maya e.g.) is because it's kind of overkill - there's usually much simpler methods which can give you equally visually pleasing results. One such method is to simply use the velocity as a rotation increment:

rotationPP += velocity * rotationSpeedFactor;

(where rotationSpeedFactor is just a scalar custom attribute to control the rotation speed).

djhush
10 October 2009, 08:22 AM
Yes, that's what I mean. Really good example you made there AndersEgleus. And also, even better to point at the easy solution ;-).

Thanks very much for your help (I will later try to go for the full length version, just for fun, but now I will will have to go for the simple one).

//Anders

CGTalk Moderation
10 October 2009, 08:22 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.

1