Wednesday, April 5

Frame zero. It drives me nuts.

What am I talking about? Well, for the sake of argument, lets suppose I have a 4 - frame, keyframed animation, with the simulation and the renderer stepped at 1/30sec per frame. The artist sees 4 frames in Maya/Max/Blender/WhizzosAtomicModeller

t
+-----------+-----------+-----------+------------+
| | | | |
+-----------+-----------+-----------+------------+
0 1 2 3 4

To play a complete animation, we have to render at 5 intervals, starting with t=0 and ending with t=4. Great, so thats what you do, after all, the artists want to see *all* of their lovely animation, right?

So along comes someone else, actually observing the behavior of the animation and says "hey, our x frame animation is playing over x+1 frames", and the guy/thing/car is overshooting their turn/cutscene spot/fov

At this point a number of things can happen.

1> We rejig the logic/calling order so that animation_update() always gets called before animation_render() and we never see the t=0 frame. Everything seems right. There's no "unstated state", the animation is always playing - that has to be right, no? Er..as along as none of the more bright artists realize and get upset (rightly) that they are losing a frame of their lovingly hand-crafted animation every time.

2> We add one to the number of frames of animation every time the AI asks what the frame count is going to be. Velocities, etc get scaled accordingly. This can annoy AI people, if things take a frame longer than they think they will, especially when doing things like cornering. The API/Interface has to be bulletproof.

3> The opposite of 1>. Have every animation signal its desire to terminate a frame before the end and never play t=4 except either to hold a pose, or blended in with another animation that is transitioning in.

I've worked in shops that have used each. My personal preference is probably 3, but I've met people quite vehement about 1. I have never had the chutzpah to pull 2, myself, but I've seen people do it successfully.

Before I write yet another animation engine (properly, this time, I always tell myself!) I'd like to sound out the opinions of the crowd. Anyone have any strong arguments pro and con for any of these three?

No comments: