Artsy Rants

CG Animation: Math Matters

  • April 2, 2015

One of the dirty secrets of working with CGI and associated animation is this: math matters. Remember in high school trig class, when you had to create all those tedious graphs of various functions? Yeah, that’s going to be important some day. Really. How about pre-calculus, when you needed to care about the instantaneous slope of functions at various points? Bingo: you’ll need that.

I don’t want to scare away the wannabe animator, but if you want to belly up to the table you need to be able to handle what’s being served. An important aspect of believable animation is timing, and to get that aspect mastered you are going to need to understand how to interpret visual feedback on how the elements of your project are behaving. Every modeling and animation package worth notice will provide you the tools to evaluate graphically what your characters (and their animatable bits) are doing.

I’m going to focus on Lightwave 3D, because that’s my tool of choice. For this discussion we’ll need to imagine a very simple actor: a fly dropping down to a surface, lighting, then taking off again. NOTE: for an actual animated project, creating believable motion can be complex and subtle, potentially requiring multiple keyframes with varied timing. I’m going to keep this very simple: a single key frame depicting the instant of landing, and how you have control over how the character enters and leaves it.

Okay, first technical issue: this fly is simply dropping to a surface and then taking off again. All we’re going to care about, then, is the object (the fly)’s motion in the vertical axis: we’ll call it the Y axis. The graph we care about will depict the fly’s motion on two axes: its vertical position (with zero being on the surface) versus the time of the animation which will be the horizontal position on the graph.

The most basic graph of the motion is called “ease-in-ease-out.” For most practical purposes this style of motion will serve you well. In fly-landing terms, it means the fly will gradually slow its descent until it gently settles on the surface (where Y = zero). Then it ascends again, gradually picking up speed as time passes. This sort of curve shape is the most common for a lot of animation motion and all things else being equal yields some very nice results. How does a graph depict this? Well, if you think about the time elapsed in an animation as the distance from left to right of the graph, and distance moved by the fly (from up there to down here) as the distance from top to bottom, it is actually quite simple: if the curve drops steeply down, the fly moves a lot of vertical distance in a short amount of time. As the curve starts to get less steep, the fly moves less distance for the time the curve measures.

If you set your way-back machine to your high school trig (or pre-calculus) days, you will see that the steepness of the curve is measured at any given point in time by its slope. That slope governs the fly’s velocity at that specific point in time. Making the fly do what you want is then based on controlling the curve’s slope for each point in time across the span of the animated sequence. If you are using ease-in, ease-out as your main concept, the fly slows as it reaches the bottom of the curve, then moves initially slowly as it leaves again but accelerates over time until it’s moving fairly quickly again a short time after take-off. That behavior is evaluated by looking at the associated vertical motion curve and making sure the slopes at each point in time are appropriate.

Here is what the fly’s landing/takeoff looks like in the graph editor when ease-in-ease-out has been applied.

ease in ease out graph

Remember what I said about math? In those terms the slope of the curve as it approaches the key frame (where the fly ends up on the surface) decreases until it reaches zero—note the tangent of the curve at the touch down point is completely horizontal. The curve for leaving that point also starts at zero and then gradually increases (the curve gets steeper over time). In animation terms the fly descends, and that descent slows until it lightly touches down. In like fashion, it takes off again slowly, and accelerates in the vertical as it leaves.

Okay, so what if we want the fly’s landing event to be different? Simple: you just adjust the curve to get different shapes. Let’s say we want the fly to land easily, but then panic and take off again as rapidly as possible. Now, assuming you have defined the actual landing point as a key frame, for that key frame you have an ease-in situation, but not an ease-out. In graphical terms, the curve will gradually approach a zero (flat) slope as it approaches the landing key frame, but the exit from that frame will be abrupt and steep. You would use the tools provided by your particular animation software package to obtain a motion curve that looks something like this:

ease in bounce out

Are you starting to see how this works? Cool!

Okay, let’s expand our repertoire with a different scenario: in this new case the fly will do a “combat landing” onto the surface as quickly as possible, then (maybe it’s disoriented for an instant by smacking into the landing surface) linger for a fraction of a second to get its bearings before it makes a standard ease-out take off. Now your motion curve should look like this:

bounce in ease out

Cool, huh? Once you know what to look for this is almost too easy, isn’t it?

Okay, let’s try one more basic variant: the fly drops to the surface as quickly as possible and, without a pause, bounces back up and onto its takeoff trajectory.This is also similar to how you’d shape the vertical motion curve for the ubiquitous bouncing ball animation exercise. Behold:

full bounce

Aaaaand, guess what? Pretty much all nuance of animation is a variant of these principles. Your actor will probably not be a commando fly; more likely the curves you’re looking at will control things like wrists or ankles, elbows and knees, fingers, and so on. The basic approach is the same: how will the curves “sell” the type of motion you’ve decided best fits the motion path in question?

Now, aren’t you glad you paid attention in high school trig?

A special thank you to Mister Gwin Harris, who tirelessly beat these principles into my teen-aged head at Pensacola High School in the mid-70s.

Spinland Studios, LLC is a high-tech branding and marketing studio in the Mohawk Valley of Upstate New York. We leverage the power and magic of 3D modeling and animation to take your company’s image places you just can’t get to any other way. Defy conventional marketing and let us bring your brand to life! Visit www.spinland.studio for more information and examples. Then hire us to kick your company’s marketing into the 21st century!


Spinland Studios, LLC is a proud member of these organizations (click each to learn more)