Handmade Hero»Forums»Code
2 posts
Coding Animations using Very Few Keyframes
Hello All,

Disclaimer:
- I apologize in advance if this post doesn't make sense or has already been covered elsewhere.
- Also, I am only on day 96 of handmade hero so I have not yet made it to the animation section yet.

Question:

I have been researching trying to incorporate animations into a game (3D) and am not getting a lot of good hits on resources I could follow through in detail (like casey explains) on how to do this.

I really like what I saw in this talk: http://www.gdcvault.com/play/1020...mation-Bootcamp-An-Indie-Approach

In the above talk it mentions using very few key frames, small amounts of IK and small amounts of physics to achieve some pretty impressive results.

If anyone knows of any detailed resources that could get me from:

Point A) knowing nothing
to
Point B) able to implement the scheme in the above talk

That would be very cool. It's possible casey's series covers some of the stuff involved doing this (not there yet) but am otherwise struggling to put together a list of resources that I could go through to learn this stuff myself.

Any insight is appreciated,

Thank you,

-Adam
Simon Anciaux
1337 posts
Coding Animations using Very Few Keyframes
Edited by Simon Anciaux on Reason: Typo
I haven't implemented a 3D animation system myself, but a first step would be to look at how animation works in 3D packages. You can try to find tutorial for a run animation in Blender (free 3D package) for example.

Character animation is composed of several steps:
- modeling the character,
- creating a skeleton: placing virtual bones (joint) in a hierarchy that we will animate,
- rigging: adding constraints (like inverse kinematics or IK) and helpers to easily animate the skeleton,
- skinning: defining which vertex of the model moves with which bone,
- animating or creating reference poses.
- exporting,
- importing model and animations in the engine,
- setup an "animation controller",
- control the animations in the code.

I can't watch the video you linked (for some reason) but if it's the Overgrowth animation video here are some thoughts.

When animating in 3D you don't animate every frame of the animation, you create poses at important moments of the animation, and let the engine interpolate between the poses. You can control the interpolation by modifying the animation curves (Casey's video on interpolation): how the interpolation happens overtime for position, rotation, and other parameters. You then can add more keyframes (poses) if you want to refine certain steps of the animation and then export (poses, animation curves...) to the engine. In the case of overgrowth, they use very few keyframes (like 3 for a run animation) and the animation process happens in the engine. Also a keyframe can be on individual parameter of a joint. For example only the y rotation component.

Then you need to interpolate between different animations to make transitions (idle -> walking -> running -> jumping) or "give character" to an animation depending on the environment (for example when walking next to a wall you could mix the walk animation with an animation of touching the wall with your hand). Animation blending is (in my small experience) a tricky thing to do right visually.

Then you can add realtime constraints to make the animation more anchored in the world: adding IKs so the feet always snap to the ground, adding physics to some element of the character...

Note that in the game engine you still have the model and the skeleton (but not all elements of the rigging). The animation are done on the skeleton. The skinning defines how the model will deform according to the skeleton.

So to do Overgrowth like animation you would need:
- to import model, skeleton, skinning, poses, rigging (IK, constraints) in your engine, unless some of those steps are done in your engine;
- to interpolate between the poses to create an animation
- to modify the animations curves;
- real time constraints like IKs, rotation limits, physics;
- to interpolate between animations;
- to apply the skinning to render the model.

Jonathan Blow has some video on animation control but I haven't watched them so I don't know what they are about.

2 posts
Coding Animations using Very Few Keyframes
Thank you for the long thoughtful comment... I just realized that i might not get notifications when the thread updates... I will definitely check out these two videos links. Looks very promising!
Simon Anciaux
1337 posts
Coding Animations using Very Few Keyframes
There isn't any notification on the site yet. You can use this page to get a list of all recent posts or use the RSS feed.