PDA

View Full Version : Falling paper and instanced particles.


mightcouldb1
10-09-2009, 01:40 AM
Hi there,
I am trying to solve a problem of falling dollar bills in the wind. I am planning on baking out animations per frame and using them as an obj sequence. My main concern is getting a little more movement out of the particles.

I can randomize their creation rotation and make a runtime expression to rotate them. But this is a little too random. I can also use the velocity to aim them with the aimDirection in the instancer but then they never flip or rotate. In short, what I want to do is make a randomized but somewhat directed simulation where:

-The paper slows down when it is falling with the up vector of the paper geometry facing along the y-axis
-The paper travels faster downward when the up vector of the paper is facing perpendicular to the y-axis

I did something like this in Houdini where I was taking a normalized dot product of the object normals and the world up axis, but I have no clue about creating this in maya. I'm posting my scene file so if someone could check it out that would be super awesome.

Cheers,
Jason

AndersEgleus
10-11-2009, 08:32 PM
Well, I did some stuff which may be what you're looking for:

1: change the rotation of the instanced geometry so its x-axis points along the bill (so you get better rotation since the order is xyz)
2: added some control-attributes (rotSpeed for rotation speed multiplier, gravPara and gravPerp for the gravity magnitudes when the normals are parallel and perpendicular respectively to scene up).
3: added the pp-attribute gravityField1_magnitude controling the gravity on a per-particle level.
4: made the rotation speed velocity-dependent (it seemed like something you wanted to do anyway)
5: moved the rotation calculations to runtime after dynamics to better control where in the pipe they happen - so the order of things is 1) what's the rotation now - update gravity magnitude 2) what's the velocity now (which is dependent on the gravity magnitude of course) - update rotation.
6: added the stuff you actually asked for in the creation and runtime before dynamics expressions -
vector $randRotPP_rad = particleShape1.randRotPP;
// convert to radians:
$randRotPP_rad = <<deg_to_rad($randRotPP_rad.x), deg_to_rad($randRotPP_rad.y), deg_to_rad($randRotPP_rad.z)>>;
// rotate the vector <<0,1,0>> about the euler rotations to get the direction of the bill's "normal".
vector $up = <<0,1,0>>;
// rotate about x:
$up = rot ($up, <<1,0,0>>, $randRotPP_rad.x);
// rotate about y:
$up = rot ($up, <<0,1,0>>, $randRotPP_rad.y);
// rotate about z:
$up = rot ($up, <<0,0,1>>, $randRotPP_rad.z);

// project on scene up:
float $parallel = abs(dot ($up, <<0,1,0>>)); // if this is 0 it's perpendicular, if it's 1 it's parallel

// map to proper range
particleShape1.gravityField1_magnitude = $parallel * particleShape1.gravPara + (1.0 - $parallel) * particleShape1.gravPerp;

Hope that does what you want.

djx
10-12-2009, 12:24 AM
Sounds like a job for nCloth. Duncan posted a confetti example (http://area.autodesk.com/blogs/duncan/confetti_and_streamers_with_ncloth) on his blog.

EDIT: I just reread your question and this
In short, what I want to do is make a randomized but somewhat directed simulation
probably means the nCloth will be unsuitable.

-- David

mightcouldb1
10-12-2009, 01:18 AM
Thanks for the replies guys. That isn't exactly what I am looking for Anders, but you definitely have set me off on the right foot. I know what I am going to do now so thanks for that. Lots of good info in that file.

Thanks for forwarding that example David. I was thinking of doing this in cloth but I didn't want the sim to get to heavy. Especially with the mesh motion in the wind. I am going to go the dot product route and just make a multiplier with the absolute value of a normalized dot that scales the effect of a particle moving downwards. I will also add some ncloth sims for forground stuff to make it look extra nice. I'll try to post the scene file here when I'm done!

Thanks for your responses.

I also have another question to throw out there if anyone is reading. I created a rolling ball with ncloth and I want the ball to collect small sheets of ncloth as it rolls over them(to create a giant dynamic rolling ball of paper). I tried turning on the stickiness attribute for the various objects but everything just sticks to the ground plane. I also tried using a negative stickyness attribute for the ground plane and a positive one for the ball and sheets of paper but still couldnt get what I wanted. It would be pretty simple make a small script that just dynamically constrains objects to each vertex of the ball but I'm not sure I want to do that because it will look kind of odd. If anyone has any Ideas please let me know! :)

Cheers
Jason

AndersEgleus
10-12-2009, 05:40 AM
About the falling bills: You may have better luck using a wind field than a gravity field, since a wind field forces particles to reach a certain velocity, rather than applying a (constant) acceleration to them.

CGTalk Moderation
10-12-2009, 05:40 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.