View Full Version : Keyframing Fluid Painted Flud Velocity

08 August 2005, 10:00 AM
Hi Guys,

I am trying to set up a fluid simulation for air flow through a jet engine. I have painted the fluid velocity vectors for the intital state to guide the air into the engine. This is fine at first, but naturally when you run the simulation the velocity rapidy dissapates within a few frames. However a jet engine would continually suck in this air. In short I need the initialy painted velocity to apply for future frames too, since the engine is continually sucking in through the animation.

Is there any way to keyframe the painted velocity, so it continues to apply over future frames?

I have some MEL ability, but the velocity direction across the fluid box is too complex to loop through and set using code, since the movement has to be very precise.

Is there a way to grab the velocity vectors and their respective voxels, and store the value to be re applied in future frames?

Am I approaching this wrong? Is there another way?

I am using a 3D container and generating the fluid at the min x boundary of the container each frame using MEL (as in many of the fluid examples) and then blowing it into the container.

I understand the fluid container has to balance, so I have got a pretty high resolution and ensured there is a lot of extra space left in the container, so the flow is not disrupted too much.

In short, any way of maintaining or animating those velocity vectors over time would be great. I hope there is an easy way to do this, I simply am not very experienced with fluid, and am really struggling.

Thanks guys,


08 August 2005, 02:33 AM
make your fluid with particles - this is the best way and it`s flexibble - u can make a many wariations - finaly effect be great - give to particles Gravity, and turbulance fields, i cannot explain here now how works particles, u need to know this, go to the Gnomon workshop, there is many tutorials about Dynamics

08 August 2005, 05:27 AM
this expression will take particle velocity and transfer it into a fluid. Maybe try using this with a particle curve flow to help guide your fluid. Apply it to your particle runtime expression and replace "fluid1" with your fluids name. Theres more information in this thread

Hope that helps!

vector $voxel;

//get paricle position
vector $pos = particleShape1.worldPosition;

$px = $pos.x;
$py = $pos.y;
$pz = $pos.z;

//get which voxel
vector $voxel = `fluidVoxelInfo -voxel $px $py $pz fluid1`;

$vX = $voxel.x;
$vY = $voxel.y;
$vZ = $voxel.z;

//get particle velocity
vector $vel = particleShape1.velocity;

$velX = $vel.x;
$velY = $vel.y;
$velZ = $vel.z;

//add velocity
setFluidAttr -at "velocity" -ad -vv $velX $velY $velZ -xi $vX -yi $vY -zi $vZ fluid1;

08 August 2005, 01:57 PM
If you want the painted velocity field to persist then you can just set the velocity to static grid in the fluidShape. The velocity will not simulate. If you want to sculpt your velocity field at each frame then look in the MEL help. You can actually set your fluids to cache one file per frame and only cache velocity. You can sculpt your velocity at each frame and then save out a cache file at that frame.

CGTalk Moderation
08 August 2005, 01:57 PM
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.