E x p r e s s i o n s - Basics

Introduction...
Expressions have been around for quite a while in the world of CGI and though the idea may seem intimidating, they'll soon be your best friend.  (But unlike friends, they'll never ask you for money; though on the other hand, they also won't be of much use when your car breaks down.)

What are Expressions?
Expressions
, sometimes referred to as "procedural animation," are simply a way of automating certain parts of the animation process to free you up to concentrate on what matters most: delivering a fully realized and believable performance.

What can I do with them?
The possibilities are truly limitless, but here are some ideas:

  • Automatically let the foot hang down when you pick it up off the ground, then make it straighten out again when you put it back down.  In this instance, you would set up an expression that would read the height of the foot from the ground and apply that to its rotation.

  • Make a character's body follow along with its feet.  In this instance, the expression would read the distance between the two feet and tell the body to always be halfway between, so when you move one foot forward, the body comes along with it.  (See the "LazyAnimator" scene on the messiah CD.)

  • Create a slider set that opens and closes a character's hands.  Each slider channel can control one finger, and an extra one can control them all so it's quick and easy to make a fist or do hand gestures that will offend some people.

  • Set limits so feet will not sink into the ground.  This would be an expression that reads the foot's distance from the ground and is fed into an expression that prevents it from going any lower.

  • Make a character blink automatically (but randomly).

  • Apply specific channels from one object to other objects.  For example, if you want the camera to follow along the road with a car but no be locked to the car's rotation or Y position.

I'm still scared.
Don't let anything you've heard about Expressions in the past fool you.  Yes, there's can be some math involved, but we've done everything we could to shield you from as much of it as possible.  Most of messiah's Expressions setups are point and click with only simple math required from you (things like +1 or x2, etc.)  Of course if you want to do all of the math from a command line you can do that too.

For example, you might want a balloon object to expand as it rises.  Here's the entire expression:   [Balloon.lwo:ypos]*2   This will read the Y position of Balloon.lwo, and multiply it by 2 (the * is the multiply symbol).  The only thing you'd have to type is the *2 part; the rest of it is just a button click.  Then all you have to do is feed that result into its X, Y, and Z scale.  If the balloon is 10 meters off the ground, it will be 20 times larger.  (Take a look at the Tutorial section for more detailed information on how to make and useexpressions.) 

One of the nice things about Expressions in messiah:
The fact that you can make adjustments to the expressions while the animation is playing and see the results in real-time is a truly wonderful thing.  It makes it so easy to fine tune everything to make it work exactly as you want.

The Expressions List:
When you are on the Command tab, the Item List becomes the Expressions List.  This is where all of the expressions show up, and where you select and arrange them.

Using Saved Expressions:
When you load a saved expression, remember to check and make sure that the items referenced in it exist in the current scene.  For example, if you have an expression that reads the acceleration of an item called
RedBall.lwo, it won't do you any good if the only object in your current scene is a big creature called LukeMcDonald.lwo.  You would need to edit the expression accordingly.

Setting when to apply the expression data:
Some expressions will need to apply before IK, some after, and some before any motion is applied.  The icons to the left of the expressions will set when things should happen. 

Why is my expression showing up in the Expressions List in red?
The expression shows up as red when it is returning a 0 value. There are two reasons that an expression may do this:
     1) There's something wrong with it.  Maybe an incorrect formula; maybe a typo.
     2) It is correctly returning a 0 value.  For example, if you have an
         expression tied to a slider and the slider is at 0, the expression line
         may be red even though there's nothing wrong with it.

Can you explain the order in which an equation is solved?
Sure.  Click here.

What else do I need to know?  What sucks about expressions?
Nothing really sucks, but there are certain things to be aware of.  Here's one of the big ones:

1) Expressions calculate based on their position in the Expressions List. Sometimes, expressions need to calculate in a certain order.  For example, you may have one expression that inflates a balloon based on its distance from the ground, and another that makes it rotate based on its size, the bigger it is, the more it rotates.  Naturally you'd want the rotating expression to be after the sizing one in the Expressions List. Just drag and drop them to where you want them.  Click here to see information about the sample scene that illustrates this.

2) If you turn Debug on to check an expression, make sure you turn it off when you're done.  It uses up CPU time, and if you're not debugging any more, why let it continue?

Advice:
Since the expression itself is a mathematical formula, a good night's sleep will pretty much guarantee that you won't be able to figure out exactly what your big, complex expression does and how it works.  Just to be sure that you'll be able to figure out what you were doing, even weeks or months later, make a text file with copies of the expressions and explanations, then save the file in the same place as your scene.  This is also a good idea in case you need to have someone else do some work on the scene.  There's nothing worse than having to reverse engineer a complex expression.   OK, there are plenty of worse things, but that still doesn't make it any better.

Additional Information:  There are four pages in the Interface--> Command tab section that have information that's vital to the use and understanding of Expressions.  They are:  Channels, Expression, Expressions List, and Variables.

Converted from CHM to HTML with chm2web Pro 2.82 (unicode)