Adverti horiz upsell
Non-Linear Animation in Production
Non-Linear Animation in Production
sdb1987, added 2005-09-25 00:52:42 UTC 57,412 views  Rating:
(1 rating)
Page 2 of 2

So what�s under the hood?

GLC�s Layered Animation System is, and I suspect that most NLA�s are, built on the great mathematical method of weighted-averaging. Simply put, weighted-averaging is the same as regular averaging except that every element in the calculation is multiplied by a number to increase it�s influence on the final result. For example: (curve1 x influence1 + curve2 x influence2)/2 = final curve is an example of a weighted-average of two animation curves. If influence1 is higher that influence2, then curve1 will dominate the final animation curve.

GLC�s animation Layers are essentially individual timelines, on which the same node can be animated differently. At any given point on the master timeline, a single layer, or a weighted-average of all of the layers can be active and visible in the final animated result. Other types of NLA editors use a block diagram in which separate clips of animation are rearranged and connected on a single timeline, and still others may use a combination of layers with block diagrams.

The script las.mel is a simple version of the system we use at GLC. It creates a simple interface from which you can create a three layers of animation on a selected node and edit them in multiple graph editors. NOTE: This script has been tested on Maya 2.0 Complete on SGI. It "should" run on NT, but there may be some erratic behavior... or so I'm told. Here's a simple walkthrough of how to use this script:

1) Download the las.mel script into a directory in your mel scripts path (e.g. ~username/maya/scripts/)

2) Create a sphere.

3) Type las in the command window or script editor, and hit enter.

4) Select the sphere, and click on the Create Layers button.

5) Type in a name for this character for example, Ball, and click ok

6) Click and drag over the nurbsSphere1_translate and nurbsSphere1_rotate attributes and click done. Generally, we've found that it's undesirable to layer scale animation, but you can play with it if you wish. I won't try to stop you... but I don't advise it. Really.

7) Cick on the arrow next to "layer 0 graph" to open up that layer's graph editor, you can do the same for the other two graphs as well.

8) Start settin` keyframes! Click on the Select Layer button and keyframe the Y translation of ball_layer0 at 0 for frame 0 and 30 and at 10 for frame 15.

9) Open the Layer 1 Graph frame and click on the Select Layer. Keyframe the X translation of ball_layer1 for frame 0 and 30 to 10 and at 0 for frame 15.

10) On playback, your ball will bounce up and down.

11) Set the ball_layer0.influence and the ball_layer1.influence to 1.

12) Now the ball will start moving a diagonal. Play with shifting the curves a bit.

If everything went according to plan, (because hey let's face it, I don't have all the time or all the possible Maya configurations on which to test this dumb thing) what you should have is a ball with three animateable layers, and a nice three panel graph editor to edit them with. So just what kind of voodoo does this script do? Well, first of all it creates three nodes which are basically virtual copies of the layered node. These three nodes are the layers themselves, that is they receive whatever animation curves that you assign. Then each attribute of each layer is multiplied by the influence attribute and then added togeteher and divided by three. So, for example, the final x translation of the ball equals: ((ball_layer0.ball_translateX*ball_layer0.influence) + (ball_layer1.ball_translateX*ball_layer1.influence) + (ball_layer2.ball_translateX*ball_layer2.influence))/3. This result is piped into a character partition, which is then sent to the final nodes. The character partition allows easy access to attributes accross multiple objects, so you can layer more than just a single sphere if you want! All of this math can be done with expressions or with dependancy graph nodes. I chose to use dependancy graph nodes so that you can see the internals visually. Select the character partition, in the above example that would be "ball", and hypergraph it showing input and output connections. What you see is the hypergraph for three layers of animation on a single object.

Well, that's about it for our layered animation system. Feel free to edit, manipulate and dissect the code that I've included. If you have any questions or, heaven forbid, the script does not work on your configuration, e-mail me and I'll see what I can do. I'd also like to hear comments, suggestions and variations that come up as you mess around with layered, and non-linear animation.