Techniqueintro
Skeletal animation
Also called skeleton animation, bone animation.
Animate a character by moving the joints of a hierarchical skeleton and deriving the surface from it, rather than moving every vertex.
Skeletal animation moves a character through a small skeleton of joints, not through its mesh. An animator, a motion capture system or a controller gives the local transforms of a few tens of joints per frame; forward kinematics turns them into world transforms; and a skinning method moves the thousands of vertices of the skin from those transforms. The motion data is small, it can be reused on every mesh bound to the same skeleton, and inverse kinematics and blending work on joints, where they are simple. It differs from blendshapes, which store whole meshes and mix them; faces often use both.
In plain words
Moving every point of a character's skin by hand, frame by frame, would take forever. So the character gets an inner skeleton, like a puppet with a frame of sticks inside. Each point of the skin is tied to one or a few of the sticks. The animator only moves the sticks: the hips, the knees, the elbows. The computer then works out where every stick is, and moves each point of the skin along with the sticks it is tied to. One walk made for the skeleton can drive any character built on the same skeleton.
When it applies
- The character is articulated: its motion is close to rigid pieces that turn at joints, as for people, animals and robots.
- The motion comes as joint data: keyframes, motion capture, physics on rigid bodies, or a controller.
- The frame budget is tight: the per-frame work is for the skeleton and for the skin, with joints, vertices and joints per vertex, and the skin step runs well on a GPU.
- It fits badly where the shape does not follow rigid parts: faces, cloth, hair, and soft tissue that jiggles. There, blendshapes, simulation, or corrective shapes go on top.
The template
- Build the skeleton. Make the tree of joints, and store it as an array in parent order, so that every parent comes before its children.
- Bind the skin. Pick the bind pose, store the inverse bind matrices , and give each vertex its joints and weights, painted or computed (see automatic rigging and bounded biharmonic weights).
- Author the motion. Store a clip as keys of the local transform of each joint over time: a rotation, usually a unit quaternion, a translation for the root and maybe for other joints, and a scale if needed.
- Sample the pose. At the frame time, interpolate the keys of each joint (see keyframe interpolation); rotations use slerp or normalized linear interpolation after the sign alignment of the quaternions.
- Mix and correct. Blend several clips per joint (motion blending), then fix contacts with inverse kinematics, for example two-bone IK on each leg.
- Run forward kinematics. One pass over the array computes with .
- Build the palette. Compute the skinning matrices , one per joint.
- Skin the mesh. Move each vertex with its weights and the palette, by linear blend skinning or dual quaternion skinning, and move the normals with the inverse transpose of the blended linear part.
Steps 4 to 7 cost per frame, and step 8 costs . A clip of frames stores values, against for the vertex positions of every frame.
Classic examples
Joints are interpolated, not vertices. Take the forearm of the bind pose page: the elbow at and the vertex with the weight 1 on the elbow, at the distance from it. One key has the elbow straight, the next has it bent by about , where the vertex is at . Halfway, slerp gives the bend , and the vertex is at , still at the distance from the elbow. Linear interpolation of the two vertex positions gives , at the distance : the forearm would shrink in the middle of the motion.
A walk cycle. A loop of keys for the hips, the legs and the arms plays over and over, while the root moves the character forward. Two-bone IK pins each foot to the ground during its contact, so that the feet do not slide; footskate cleanup is the general fix for captured motion.
GPU skinning in a game. The CPU or a compute pass samples the clips and runs FK for each character, then uploads the palette of ; the vertex shader blends up to four joints per vertex. glTF stores the joints and weights of a vertex in sets of four, which matches this layout.
Motion capture. Markers on an actor are fitted to a skeleton each frame, which gives joint rotations; the same data then drives any character with that skeleton, or with a mapped one (see motion retargeting).
Variations
- Skinning method. LBS is the fast default; DQS removes the candy wrapper artifact of twists; delta mush and implicit skinning correct the result.
- Corrective shapes. Shapes that fade in with the pose fix the faults of skinning at elbows and shoulders (pose-space deformation).
- Helper joints. Extra joints, such as twist joints in the forearm, driven by rules from the main joints, spread a twist over more of the limb.
- Procedural and physical motion. Inverse kinematics, look-at rules and ragdoll physics set some joints each frame in place of the clip.
- Additive layers. A clip stores the difference to a reference pose, and it is added on top of another clip, for example breathing on top of a walk.
- Compression. Clips are stored with fewer keys and fewer bits per key, because the frame count times the joint count can be large.
Pitfalls
- Wrong product order. , not ; and , so the scale acts first.
- Joint order. One pass of FK needs the parent first; sort the joints of a file before use.
- Euler angle keys. Interpolating Euler angles gives curved, uneven paths and fails near gimbal lock; interpolate quaternions.
- Quaternion signs. and are the same rotation; without the sign flip, slerp takes the long way round.
- Non-uniform scale on a parent. With , a non-uniform scale of a parent shears the rotated frames of its children; many tools keep the scale uniform or do not pass it down.
- Missing inverse bind matrices. Skinning with in place of moves the mesh even in the bind pose.
- Weights. The weights of a vertex must be nonnegative with the sum 1; after quantization, normalize them again.
Exercises
- A skeleton has the parent array . Is it in parent order, and which joints move when joint 1 turns? Answer. Yes, every parent index is smaller than its child. Joint 1 and its subtree, joints 2 and 3, move; joints 0 and 4 do not.
- In the arm of the first example, the shoulder at the origin also turns by about while the elbow is bent by . Where is the vertex ? Answer. , because the whole arm turns about the origin.
- A character has 60 joints and 20000 vertices with 4 joints each. Count the matrix products of FK and the matrix-vector products of LBS per frame. Answer. 59 products for FK and 60 more for the palette, against 80000 for the skin: the skin step dominates.
- Why does a clip made on one skeleton look wrong on a skeleton with longer legs, even with the same joint rotations? Answer. The rotations are the same, but the translations of the root and the positions of the feet scale with the legs, so the feet slide or float; this is the subject of motion retargeting.
References
- Rick Parent, Computer Animation, Algorithms and Techniques, 3rd edition, Morgan Kaufmann, 2012, the chapters on kinematic linkages and on the animation of articulated figures
- Ladislav Kavan, Part I, Direct skinning methods and deformation primitives, in Alec Jacobson, Zhigang Deng, Ladislav Kavan and J. P. Lewis, Skinning, Real-time Shape Deformation, SIGGRAPH 2014 course, Section 2 (linear blend skinning)
- The Khronos Group, glTF 2.0 Specification, Section 3.5 (nodes, the hierarchy and the T * R * S transforms) and Section 3.7.3 (skins, inverse bind matrices, and sets of four joints and weights per vertex)
Where this leads
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag K2Q2Q7 Edit this page History Report an error Markdown