PDA

View Full Version : random control


modernPrimitive
04-24-2006, 07:50 PM
Hi all,

I have to create a sort of "leaf swaying in the wind" effect on some particles and it should be slightly randomised. Sort of like a swing that slows when it reaches it's trajectory and then swings back again in the opposite direction. The other particle instances should implement the same, but with some sort of randomisation ie: different start time, slight rotational differences etc etc.

I thought of emitting a group of copied "leaves" with respective motion paths and variation on their keyframes, but the problem is that the emitter needs to emit 1 at a time to get the right look, so a group would look wrong.

Any ideas would be greatly appreciated. Thanks.



PS: My MEL is not great but I come from a programming background so I can pick up code reasonably quickly.

scene
04-24-2006, 08:24 PM
using the rand function to create expresions will give a huge help .
for example , in case of spirte
in spriteTwistPP ATTR you should write a creation expresion
particleShape1.spriteTwistPP=rand(360);

and define a new perparticle ATTR , called , say .. randTwist
and write a creation expresion for it
particleShape1.randTwist=rand(-.8,.8);

now go backe to the spriteTwistPP and write a runtime expresion
particleShape1.spriteTwistPP += particleShape1.randTwist;


and you will get a random twist for each particle

modernPrimitive
04-24-2006, 08:49 PM
Thanks Scene,

I'm using a geom instancer but I guess the principle is the same. I am currently doing this with the following line for the particle creation:

particleShape1.ppCustRotationVector += <<0,rand(-0.001,0.001),0>>;

-I need to keep the rotation on a certain axis, thus the slight variance on only the y axis.

I think I might get something happening using a sort of mod operator with time to change the direction of the rotation when it reaches an apex. My math isn't good enough to anythin other than linear type calcultations. (wish I'd paid attention at school!)

-thanks for the help though - the main challenge is getting the "wafting" from one apex" to another" type motion.

scene
04-24-2006, 09:16 PM
I think I might get something happening using a sort of mod operator with time to change the direction of the rotation when it reaches an apex. My math isn't good enough to anythin other than linear type calcultations. (wish I'd paid attention at school!)

-thanks for the help though - the main challenge is getting the "wafting" from one apex" to another" type motion.

maybe using a locator will help , put this locator where the apex is ( where you want to change the direction of the rotation)
example
and using a (if) function , so you will telling maya , when the particleShape.position = the position of this locator ( wich defined in a vectoer variable) , then change the direction of the rotation.

Vympel
04-24-2006, 10:04 PM
You can use the cycle options of Instancer more expressions to randomize the values,trying to use some animated leaves and create a per particle attribute to control de age option of instancer node, more expressions to randomize the position, scale and acceleration, you can place these expressions in "custom attribrutes" and or in the standard per particles attributes.

You tried the 'if statement" to control the rules of rotation?

modernPrimitive
04-24-2006, 10:46 PM
You can use the cycle options of Instancer more expressions to randomize the values,trying to use some animated leaves and create a per particle attribute to control de age option of instancer node, more expressions to randomize the position, scale and acceleration, you can place these expressions in "custom attribrutes" and or in the standard per particles attributes.

You tried the 'if statement" to control the rules of rotation?

Yeah, I kind of did a (if particleID+time > a certain value then rotate in a different direction.)

I can't seem to get the cycle options of the instancer to work the way I would like it too (never used it before). I'm under the impression that it merely cycles through a list of geometry per frame (or per second) per particle. I was hoping you could get it to work as a sort of geometry Birth list which would cycle through the geometry at birth time and then keep trhat geometry for the duration of the particle's life. - couldn;t get that to work though?

Vympel
04-24-2006, 11:27 PM
The cycle really cycle among a list of geometrys (but the particles keep the geometry for all of your life). You can make expression to the cycle emit a determined geometrys for a period of time or using expressions to randomize the geometrys emmitted in this periof for example

CGTalk Moderation
04-24-2006, 11:27 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.