Thursday, July 31, 2008

Time passes

Lots of applications incorporate animation. In fact, I would say that animation and interactivity are the two hardest things to add well to any application. I don't intend to address interactivity as I really don't know that much about it. So then we are left with time.

What exactly is animation? By animation, I generally mean interpolation; not frame-by-frame. I mean that you have something like two values, and an equation that takes you from value one to value two based off a third, independent variable.

This is a generally very useful and beautiful idea. Something really cool that Maya lets you do is it allows you to add a property that controls a set of other properties based off some interpolation of the original property. Lets say you have an animated face. You make it look like it isn't smiling and take a snapshot of your data (this snapshot is usually called a keyframe). Now you make it look like it is smiling and take another snapshot. Figure out the differences between the two of them and add a property where when the property is 0 the face isn't smiling and when it is 1 the face is smiling.

Crazy and simple; but the results of allowing the users to do this can *greatly* simplify a lot of tasks. Because the next thing an artist will do is to add a set of properties that describe a set of facial expressions and then try to play with all of them and see what happens. They then get completely bizarre output that is often delightful and have expressions on characters that no-one really understands either what the expression means *or* what is mathematically going on underneath the covers.

So there we have something *animating* due to user input. Now lets say you have a clock that continually increments based on time. You patch this value into the facial animation engine and all of a sudden the person may look like they are laughing (assuming the value is moded by its range). But that brings up another topic; what sort of transformations can you do on the input stream to get interesting behavior?

What if you take twice the range of the input and mod the clock by twice the range. If you time is in the upper half of the range then you run it backwards; if it is in lower have you run it forwards. This would be called ping-pong, and would make the animation bounce between the interpolations like someone dancing or doing facial exercises.

What if you multiply the input by a number? You can see that how you manage this input stream *also* gives you ranges of creativity and interesting effects?

So you have some function that takes input that ranges from 0-1 and produces output based on keyframes. You get all sorts of interesting properties by controlling this input. Lets say you use a bezier function to control this input range. Then you get bezier animation; except it is normalized so you can take the same bezier curve and apply it to several inputs. You can merge input streams by using a combination operator like divide or add (or subtract). You can do any number of crazy input nonsense and really produce some interesting stuff.

You can also setup processing graphs of these inputs. This will mimic behavior that makes a set of animations run in the *time context* of other animations.

So now lets get back to applications. Lots of applications allow animation. But none (or very few) of them allow you to setup arbitrary processing graphs to experiment with arbitrarily complex and clever animation systems. Breaking animation down into its components really allows you to do some interesting things.

For instance, what if the beginning value *isn't* a keyframe? What if it is based on something else; like an object's position or something like that. Then the animating object will animate from one object to a point in space. We called these dynamic keyframes; they are cool; I swear it. They allow you to mix interactivity with animation; without them you run into a lot of situations where you just can't get the object to move around reasonably.

We have an acyclic directed graph of floating point processing routines (at least; presumably other information could flow down this graph along with the floating point values). We have an object that generates a consistent increasing signal, we have things that will *reset* that signal when told so it appears to start from zero. We have sets of functions that given a floating point value can produce another floating point value. By combining these functions in clever ways we produce sophisticated and somewhat non-obvious such as character animation. But the point is that I think it would be cool to allow very open manipulation of this processing graph.

Chris

No comments: