PDA

View Full Version : Morphing particle groups?


paulo@c6t
04-20-2010, 04:35 PM
Hello,

I am working on a project where we would like to animate a volume (a polygonal model) filled up with particles. The particles would each time explode out of the object and reform themselves into another shape and then explode out of it again and reshape into another shape.. and so on and so on... like a sequence of particles shaping different models.
How do I do that? Do I need nParticles or can I do it with normal particles in Maya 2008 (my workstation has maya 2008)?
I would start by modeling the different models before looking into the particles animations... then how would I proceed?

thanks

spiderman3
04-20-2010, 08:14 PM
check out the hermite function in maya

also check the tutorial mentioned below for hermite function

http://www.creativecrash.com/maya/tutorials/dynamics-fx/c/particle-morph

Aikiman
04-20-2010, 09:50 PM
check out the hermite function in maya

also check the tutorial mentioned below for hermite function

http://www.creativecrash.com/maya/tutorials/dynamics-fx/c/particle-morph

Thats a cool technique there, thanks for that! This would work hand in hand with using multiple goals if someone prefers the randomness of fields and dynamic movement and still have the colour morph as well using the hermite expression.
Nice share.

paulo@c6t
04-20-2010, 10:13 PM
thanx spiderman3 ! I'll check it out tomorrow with simple shapes. I'll let you know how it goes.

paulo@c6t
04-21-2010, 09:41 AM
it works great ! thank you. How can I slow down the morphing? or add some turbulence to it?

EDIT : ok I figured it out how to slow down the animation. How do I add a third state to the expression? and how can I pause the morphing for one second?

Aikiman
04-21-2010, 10:18 AM
To slow it down to half speed, multiply time by 0.5 for example.

paulo@c6t
04-21-2010, 10:23 AM
I was changing the parameters on

particleShape1.position=hermite(particleShape1.position,particleShape2.position,
<<0,0,0>>,<<0,0,0>>,smoothstep(rand(0,2),rand(3,3.5),time));

to

particleShape1.position=hermite(particleShape1.position,particleShape2.position,
<<0,0,0>>,<<0,0,0>>,smoothstep(rand(0,2),rand(10,10.5),time));

am I doing it correctly?

Aikiman
04-21-2010, 10:32 AM
Yep you can do it that way. If you want to add another state change particleShape2 in the expression to particleShape3 obviously and offset those values you are currently changing to higher values. Afterall they are being driven by time so think of those values as seconds.

paulo@c6t
04-21-2010, 10:51 AM
If I just replace particleShape2 to particleShape3 then it morphs from the first shape to the third one.. obviously. I want it to change from the first one to the second one and then to the third one... with a pause of one second at the second shape.
I don't know anything about syntax in expressions... how do i add stuff to the expressions?

Aikiman
04-21-2010, 11:20 AM
Leave the intial expression as it is but then copy and paste another set after it then change the particleshape number. Likewise if you want yet another morph, copy and paste again.

The numbers in the smoothstep are based on seconds so if you want a one second delay between each morph, just increase the rand values by one whole number. Remember you will have to adjust these values anyway by offsetting them otherwise if they are all the same time value, the morph will take an average of all positions and colours instead of going from one position to the next.

paulo@c6t
04-21-2010, 12:55 PM
It works ! great ! Thank you so much for your help.
I'll play around with it more now and try to bring much more shapes into play.

paulo@c6t
04-21-2010, 03:55 PM
me again :-)
How can I animate one of the shapes moving from left to right? so that it would morph while moving... For example particle1 would morph into particle2 in movement.
I tried to key the translation of particle2 but the morphing ignores the translation.

noticeus
04-21-2010, 05:05 PM
I would use goals on your particle2 system and then morph your geometry while morphing particle1 with the hermite function.

Aikiman
04-21-2010, 08:59 PM
The reason why it wont work is because you are animating the transform of the particle shape and not per particle. As mentioned use goals. Create new parentU and parentV PP as well as new goalU and goalV PP. Then in creation and runtime write:

goalU = parentU;
goalV = parentV;

make sure you have 'need parentUandVs' on for that partciles surface emitter.

paulo@c6t
04-27-2010, 04:53 PM
thanks for the help.
how do I add a turbulence effect to the hermite function? I would like the particles to tremble when they reach their states... I tried adding a turbulence effect to the particles but nothing seems to happen. I guess they are completely driven by their expressions.

noizFACTORY
04-27-2010, 07:34 PM
check out the hermite function in maya

also check the tutorial mentioned below for hermite function

http://www.creativecrash.com/maya/tutorials/dynamics-fx/c/particle-morph

Thats a great one! Thanks for sharing.

-Sachin

Aikiman
04-27-2010, 11:19 PM
Im no maths expert but I managed to pull it off.


// Create your jitter expression
vector $randPP = sphrand(.5)*(1-(smoothstep(0,2.5,time)));

// Write hermite function as before
vector $hermite = hermite(particleShape1.position,particleShape2.position,<<0,0,0>>,<<0,0,0>>,smoothstep(rand(2),rand(3,4),time));

// Add jitter and hermite together
particleShape1.position = $hermite+ $randPP;


Essentially this will work for the first 2.5 seconds, if you need it to work on multiple morphs then I would offset the jitter expression inside if statements based on frame or time. You'd need to create if statements anyway for multiple morphs using expressions.

Aikiman
04-28-2010, 12:07 AM
If you want the noise to ease in and ease out then you could build a userScalar1PP ramp based on userScalar1VPP and write a smoothstep expression in runtime...

particleShape1.userScalar1VPP = smoothstep(0,2.5,time);

then multiply $randPP with userScalar1PP like so..

// Create your jitter expression
vector $randPP = sphrand(.5)*particleShape1.userScalar1PP;

So now you can use the B/W chips on the ramp to control the amount of noise as well as where you want it to occur, so more user control.

paulo@c6t
04-28-2010, 09:37 AM
thank you so much for your help aikiman.
I'm getting a bit lost and please apologize for my complete ignorance with expressions.
So now I kind of just duplicated the whole expression you gave me one after the other like this:

// First Morphing
// jitter expression
vector $randPP = sphrand(.5)*(1-(smoothstep(0,3.5,time)));

// hermite function
vector $hermite = hermite(particle0_Shape1.position,particle0_Shape2.position,<<0,0,0>>,<<0,0,0>>,smoothstep(rand(0,2),rand(3,3.5),time));

// jitter and hermite together
particle0_Shape1.position = $hermite+ $randPP;

// Second Morphing
// jitter expression
vector $randPP = sphrand(.5)*(1-(smoothstep(0,9.5,time)));

// hermite function
vector $hermite = hermite(particle0_Shape1.position,particle0_Shape3.position,<<0,0,0>>,<<0,0,0>>,smoothstep(rand(3,5),rand(6,6.5),time));

// jitter and hermite together
particle0_Shape1.position = $hermite+ $randPP;

I guess this is the dumb way to do it, right? Can it be optimized? Can't I just declare a general jitter over everything and control the whole effect with a ramp.. like you are explaining. I tried to introduce the ramp but I didn't find userScalar1VPP. I put a ramp on userScalar1PP and wrote your expression :

particle0_Shape1.userScalar1VPP = smoothstep(0,2.5,time);

but it doesn't find the particle0_Shape1.userScalar1VPP ??

Aikiman
04-28-2010, 11:00 AM
There are a couple of odd typos in that text there. For example "particle0_Shape2", make sure this is exactly the name of your particles also I can see some spacing issues that may or may not cause any syntax errors. Also on the second smoothstep make sure the first number is offset also not just the second one.

To create a userScaler1VPP create a custom attribute (use the help docs you will see the userScalar1PP attribute already exists you just have to create it). When you create a ramp it defaults to ParticleAge, change this to userScalar1VPP, now this will show up in the attributes and you can write the expression on it.

Perhaps best to focus on getting the first morph right then copy and paste text and offset values afterwards. I believe you still have to use if statements but we can cross that bridge when you get there.

paulo@c6t
04-28-2010, 12:09 PM
particle0_Shape1 is correct. this is how I named my particles..

ah ok, I didn't see that when creating the ramp, I could access the control box and change ParticleAge to userScalar1VPP. I created a simple ramp from black to white. Then indeed the userScalar1VPP appears as an attribute.
now my code in the expression is :

// First Morphing

// ramp control
particle0_Shape1.userScalar1VPP = smoothstep(0,3.5,time);

// jitter expression
vector $randPP = sphrand(.5)*particle0_Shape1.userScalar1PP;

// hermite function
vector $hermite = hermite(particle0_Shape1.position,particle0_Shape2.position,<<0,0,0>>,<<0,0,0>>,smoothstep(rand(0,2),rand(3,3.5),time));

// jitter and hermite together
particle0_Shape1.position = $hermite+ $randPP;

but the particles now disappear after 2 seconds... where did I do something wrong?

Aikiman
04-28-2010, 08:53 PM
YEah thats right I had that prob too, and then realised Maya automatically changes the lifespan to 1 second after you create a ramp. Why?! .......... knows. So change it back to forever or whatever it was before.

paulo@c6t
04-29-2010, 11:06 PM
ok great i got it work. it was indeed just that parameter. thanks

CGTalk Moderation
04-29-2010, 11:06 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.