Digital humans the art of the digital double
Ever wanted to know how digital doubles are created in the movie industry? This course will give you an insight into how it's done.
# 1 03-05-2003 , 05:57 PM
Registered User
Join Date: Nov 2002
Location: Pakistan
Posts: 57

EXPRESSIONS FOR ALL! (knowledge tidbits)

Sorry to break-in mind-raper, but I'm making this thread STICKY so it will always be at the top for everyone to learn from!

Post your particle/dynamics EXPRESSIONS here for everyone to learn from!

Please write a little "how-to" along with your expression, so we will all know how to try it, and experiment with applying it to our dynamics/particle scenes!

Thanks all!user added image


THREAD STARTS HERE first post by mind_raper
here's a little nice expression to .. colorize you particles system,
i have learnd it from gnomon workshop well its really good & ...
is very simply

first from general options add per particle attribute
the rightclick---> write creation expression::

take ur your are particle shape node (particleShape1) and add per particle attiribute (rgbPP)
and then assign a random value b/w (minVector i.e <<.3,5,7>>) and (maxVector i.e <<.5,7,1>>).

select the render type streaks or multi-streaks or what ever u want check on the color Accum button and the lightining button too

play around the values to see different color effects...


particleShape1.rgbPP = rand(<<.3,5,7>>,<<.5,7,1>>);



hope u find it usefull
enjoy - -> :banana:


Learn the Rules|Then|
Burn the Rules Book
# 2 03-05-2003 , 06:25 PM
ragecgi's Avatar
Registered User
Join Date: Sep 2002
Location: Minnesota, USA
Posts: 3,709
Thanks mind-raper!

I think everyone should know the power of using expressions with particle systems, and your post will help others "EXPERIMENT" and learn, rather than be affraid, or overwhelmed.

Good job m8!


Israel "Izzy" Long
Motion and Title Design for Broadcast-Film-DS
izzylong.com
# 3 03-05-2003 , 06:44 PM
ragecgi's Avatar
Registered User
Join Date: Sep 2002
Location: Minnesota, USA
Posts: 3,709
Here is a little expression tidbit from me to help this thread along:

TO RANDOMIZE STUFF: selectedObjectname.tx = rand(-10,10);

"tx", or whatever, is the attribute you can choose to have the expression applied to.

So, for random particle ROTATION:

selectedObjectname.rotX = rand(0,360);
selectedObjectname.roty = rand(0,360);
selectedObjectname.rotz = rand(0,360);

Try this as a CREATION expression, AND then try it as a RUNTIME expression to see the difference between these calculation typesuser added image


Israel "Izzy" Long
Motion and Title Design for Broadcast-Film-DS
izzylong.com
# 4 08-05-2003 , 06:07 PM
Registered User
Join Date: Nov 2002
Location: Pakistan
Posts: 57

Speed, Stuff

i think that was difficult...
well no prb....

tell u one thing....they are very easy just u need little bit of understanding......here's one more example from maya's documentation!
moving the particles.....

Use the Particle Tool to place a collection of particles in the workspace. You then create the following creation expression to control their velocity:

particleShape1.velocity = <<0,1,0>>;

All the particles move in a Y-axis direction at one grid unit per second as the animation plays.

explaination

"particleShape1" is the shape node for ur particle object that can be anything that u have named

"velocity" is the attirbute for shape node.

"<<0,1,0>>" is the value for X, Y, Z Respectivly
try to change the values and make it more dynamic with coditional statments

like if frame==something
move in X direction

or the way u wanted.


hope this works for u ....!

enjoy coding...! user added image


Learn the Rules|Then|
Burn the Rules Book

Last edited by mind_raper; 09-05-2003 at 07:31 PM.
# 5 20-05-2003 , 08:04 AM
Registered User
Join Date: Nov 2002
Location: Pakistan
Posts: 57

Kill particles a few moments after they reach a specified locator

create an emitter and a locator and create another locator
first select the particle and shift select the 1st locator
goto --- > Particles -- > goals--option reset the setting
and press ok
do the same with other locator
Animate the particle from one locator to another using Goalweight attribute

then add the following script and see the magic of expressions
thanks for the cool expression
<< Daniele Tosti >>

<b>
vector $partPos = particleShape1.position;
if ($partPos > locatorName.ty)
{
particleShape1.lifespanPP = rand (5);
}
else
{
particleShape1.lifespanPP = 5 ;
}</b>

enjoy coding user added image
:banana:


Learn the Rules|Then|
Burn the Rules Book

Last edited by mind_raper; 20-05-2003 at 08:07 AM.
# 6 02-07-2003 , 01:40 PM
Registered User
Join Date: Nov 2002
Location: Pakistan
Posts: 57

Attribute of an object at a certain

This expression will take the attribute of an object at a certain “offset” time, and apply it to another objects attribute. For instance it will take it off a cubes translateZ attribute, and assign it to a spheres translateZ attribute.

-Create a new scene.

-Create a polyCube.

-Create a polySphere.

-Translate the sphere about 10 units in Y.

-Open the Expressions editor, then Select Filter/By Expression Name.

-Type in the following:

int $offset = 10;
int $currentTime = `currentTime -q`;
$offsetTime = $currentTime - $offset;
$cube1Zpos = `getAttr -t $offsetTime pCube1.tz`;
pSphere1.translateZ = $cube1Zpos;

-Hit Create.

and here is the explaination !


//Time offset expression
//offset length (in frames)
int $offset = 10;


//Get current time
int $currentTime = `currentTime -q`;


//Substract the offset to the current time
//so if current time is 10,
//and offset is 2, offsetTime will be 8
$offsetTime = $currentTime - $offset;


//Get the value of pCube1.translateZ
//at frame $offsetTime (8 in our example)
$cube1Zpos = `getAttr -t $offsetTime pCube1.tz`;


//Assign it to pSphere1.translateZ
pSphere1.translateZ = $cube1Zpos;

This could be taken much further, you could for example setup joints and IK so it looks like power tubes are going from the mothership to the children, you could also add a custom attribute called “motion” and multiply the “noise” section of the expression by it, so that if you decide to turn you noisy motion off you would just have to set the custom attribute to 0. You could keyframe that attribute so you could control the random “floating” motion of the ship throughout the scene so it stops looking as if it were floating if it lands for example.

This type of setup could also be applied to a cranefly, or any other type of futuristic flying object etc. Experiment with setting all sorts of different relationships etc until you are comfortable with this expression.


this is very handy little snippet from
Oliver Shyal Beardsley
thanks alot for .......it

hope you enjoy it...........


Learn the Rules|Then|
Burn the Rules Book
# 7 03-07-2003 , 03:06 AM
Registered User
Join Date: Apr 2002
Posts: 222
Nice thread here, i know i'll be learning from it, just hope it sticks user added image

# 8 03-07-2003 , 12:06 PM
brian_ellebracht's Avatar
Registered User
Join Date: Oct 2002
Location: St. louis Mo
Posts: 1,580
Wow nice thread user added image THis is a really good idea
brian


Please check
My (old) website!
# 9 03-07-2003 , 02:38 PM
ragecgi's Avatar
Registered User
Join Date: Sep 2002
Location: Minnesota, USA
Posts: 3,709
It can only get biggeruser added image


Israel "Izzy" Long
Motion and Title Design for Broadcast-Film-DS
izzylong.com
# 10 04-07-2003 , 08:14 AM
Registered User
Join Date: Nov 2002
Location: Pakistan
Posts: 57
yes absolutly !
Cause expression makes ur animation look more healthy and realistic
support is all needed...!


Learn the Rules|Then|
Burn the Rules Book

Last edited by mind_raper; 04-07-2003 at 08:16 AM.
# 11 04-07-2003 , 08:35 AM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Here's a little tip. If you use the seed() function you can be sure your expression with rand() functions run always the same way.

Code:
{
	seed(1234);

	float $foo = rand(-5, 5);
}
The $foo will contain a random value, but it is allways the same in a given frame...


Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
# 12 04-07-2003 , 04:03 PM
ragecgi's Avatar
Registered User
Join Date: Sep 2002
Location: Minnesota, USA
Posts: 3,709
Cool K!!


Israel "Izzy" Long
Motion and Title Design for Broadcast-Film-DS
izzylong.com
# 13 06-07-2003 , 06:31 PM
Registered User
Join Date: Nov 2002
Location: Pakistan
Posts: 57

Removing linear breaks

Moving a turbulance field with object the problem is..
noise patterens move slong with it
if u we want remove linear breaks
we use turbulance phase attribute

let say you....want to move a turbulance field...through particles and want to....
effect its nearest as u know turbulance field is not good at moving, thats why to aviod that we use phase as per need


Example script :


turbulance field.phaseX = times * 4;

play wid it....
it really handy in particle system..!

enjoying coding..!


Learn the Rules|Then|
Burn the Rules Book
# 14 06-07-2003 , 11:12 PM
ragecgi's Avatar
Registered User
Join Date: Sep 2002
Location: Minnesota, USA
Posts: 3,709
Rock on m8!


Israel "Izzy" Long
Motion and Title Design for Broadcast-Film-DS
izzylong.com
# 15 16-07-2003 , 12:11 PM
Registered User
Join Date: Nov 2002
Location: Pakistan
Posts: 57

Some Handly Little Expressions

Rotating Wheels of Car or anything

Wheels on a car: apply to the wheel rotate in z channel
wheel.rz=car.tx/(2*3.145) * 1*360;

Wind shield wipers

Windshield wipers: apply to the wiper rotate in x channel
wiper.rx = (sin (.9 *time)*45)+10;
wiper = wiper
sine = sine
speed = how much fast you want() here i have put .9
time = time
degree = i put (45)
offset for position i put (10)


Random

Imbedded Sin Waves for a Random Effect
ty = sin (sin (.5 * time) * time);


enjoy ~ !


Learn the Rules|Then|
Burn the Rules Book
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads