Software Engineering and Game Development Lecture 12 --- Skeletal animation Software Engineering and Game Development Elias Holmlid
Today’s plan First, going to finish off what we did yesterday Then... animation Keyframed animation Skeletal animation Elias Holmlid
Key framed animation Also called per-vertex animation or morph-target animation Define a few frames, then fill in the blanks (tweening) Elias Holmlid
Key framed animation on meshes Static mesh model for each frame Only the key frames are exported Good for facial animation Used in Quake II and Quake III for example Elias Holmlid
Skeletal animation A hierarchical set of bones Possible to blend different animations together (smooth run->idle for example) Elias Holmlid
Skeletal animation Each frame, we can represent the transform for each bone as a matrix This is called a matrix palette, i.e. an array of matrices Elias Holmlid
Skeletal animation Vertex blending Each vertex in the mesh can be influenced by several bones Final position of vertices calculated as a weighted average of the influencing bones Thus, smooth transitions can be achieved at joints Usually, four bones / vertex is enough Each vertex contains blend indices and blend weights. Elias Holmlid
Skeletal animation Only bones... Elias Holmlid
Skeletal animation Skinned bones... Elias Holmlid
Inverse kinematics Find out how to rotate bones in order to end up at a desired position http://www.youtube.com/watch?v=tOAFCvSnNDc Elias Holmlid
Ragdoll physics Often used in death animations Place constraints on how the skeleton’s bones can move in relation to each other Then use physical simulation on bones Elias Holmlid
Ragdoll Physics http://www.youtube.com/watch?v=gbuA-HEbROk http://www.youtube.com/watch?v=WsEHxw-hv90 Elias Holmlid
Skeletal animation in XNA .X and .FBX formats support skeletal animation .FBX concatenates all tracks into a single timeline .X supports more than one track I’ve had most luck using the kW X-port plugin for 3D-studio (http://www.kwxport.org/). Elias Holmlid
Skeletal animation in XNA Content pipeline needs to be extended Elias Holmlid
What has to be implemented? Animated Model Processor ContentTypeWriter ContentTypeReader Classes for storing the data during runtime Compiled as a library Keyframe (stores a keyframe for one bone) AnimationData (stores one animation) AnimatedModelData (stores skeleton+all animations) Skinned Effect Elias Holmlid