View Full Version : Fluid emission triggered by velocity of emitting surface?

11 November 2009, 01:57 AM
Hey guys!

So here's my deal. I'd love to be able to use the fluid effects in Maya as my test renders have come out really nicely so far, but until I really feel like I can use it how I want, it's pretty useless to me.

What I'd like to know is how one might define the density of the liquid being emitted based on the velocity of that emitting surface at any given time (and then potentially produce a lesser and lesser amount as time passes and the velocity is above 0).

My other problem here is the fact that I've done absolutely no scripting, so this is my trial by fire. I'm going to continue to research, but I'd love to hear some creative input from the pros.

thanks everyone!

11 November 2009, 02:58 AM
I assume you mean fluids not liquids as in nParticles as you want to affect density. Can you explain what kind scene you are trying to build? I dont recall fluid emitters have a velocity attribute.

11 November 2009, 03:25 AM
sorry, that did sound a little confusing now that I read it again. I'm essentially trying to create a destruction sequence using ncloth and rigid bodies, and I'd love for any chunks of debris that get knocked loose to actually emit a volumous smoke that can waft downward to create that "sheeting" debris effect. I'd love to apply the object that crumbles as an emitter and only allow emission of that smoke when they've been knocked loose.

If there's an easier way to go about this, I'm all ears too

edit* for clarity's sake, I'm talking about Maya fluids, not nparticles, though knowing both ways would be awesome too

11 November 2009, 07:10 AM
well this is the general code you would need to affect a single rigid body...

// Query the velocity of a rigid body and find its
// length so you end up with a single value

vector $vel1 = `rigidBody -q -velocity rigidBody1`;
float $magVel1 = mag($vel1);

// Now create a condition to test when
// the rigid body moves to emit density

if ($magVel1>0)
setAttr "fluidEmitter1.fluidDensityEmission" 1;
setAttr "fluidEmitter1.fluidDensityEmission" 0;

if you want you can multiply the emission by the $magVel1 so the faster it goes the more it emits or use division if you want the opposite. Currently I dont think you can query velocity with nCloth.

11 November 2009, 04:09 PM
that makes sense. I still need to figure out how to enter that at runtime...All the melscript stuff I've been through is still really about how to mimic gui commands :-P.

I can figure that part out on my own, but I did have one further question.

Unless I'm misunderstanding it, you'd be treating the rigid body object as one big object here... I'm thinking it would only emit from the faces that are in motion (which I'm sure is way more difficult)

I'll keep taking baby steps for now, but that's where I'd like to end up.

thanks for the help so far!

11 November 2009, 05:57 PM
Depends on your scene setup which I dont have in my lap so I cant really comment, but if you are shattering geometry into many pieces, then each piece can become a rigid body which means each piece would need to be an emitter as well.

I imagine that to keep it simple, only emit fluids from the larger pieces and when selecting them to create the emitter, select them in order so that your emitter Id has the same value as your rigid body count.

This would make creating expressions for each one possible because you could try a "for in" loop to run the animation or if that didnt work, use the loop again to create the expression nodes for each rigid body.

CGTalk Moderation
11 November 2009, 05: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.