1 / 17

Maths & Technologies for Games Animation: Practicalities

Maths & Technologies for Games Animation: Practicalities. CO3303 Week 3. Today’s Lecture. Animation Issues Transformation Decomposition Keyframes Interpolation Revisited Playing Animations Blending Multiple Animations Motion Extraction. Animation Issues.

mikasi
Download Presentation

Maths & Technologies for Games Animation: Practicalities

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Maths & Technologies for GamesAnimation: Practicalities CO3303 Week 3

  2. Today’s Lecture • Animation Issues • Transformation Decomposition • Keyframes • Interpolation Revisited • Playing Animations • Blending Multiple Animations • Motion Extraction

  3. Animation Issues • We have seen a method to interpolate a model’s pose between keyframes • Surely we can now build an animation system? • No • Several major practicalities to deal with • Need further refinements to the previous theory

  4. Animation Issues • Assume our game has: • 30 characters with 64 bones, 60 animations each • Animations are 5 seconds long, store 8 keyframes / s • Memory usage = 30*64*60*5*8* sizeof(keyframe) • If our keyframe is a 4x4 matrix then = 295Mb • If a quaternion, position and scaling, then = 184Mb • Rather too much memory used, especially for a console • Can improve on this

  5. Animation Issues • Sometimes need to play more than one animation at the same time • E.g. Character running and firing a gun • Or character standing and firing • Would like to blend the firing animation with the character’s other motion – 2 animations at once • Simple interpolation insufficient • Also, how to combine movement in the scene with movement in the animation? • Will look briefly at several practical animation techniques to address these issues

  6. Transformation Decomposition • Each bone in a model has a separate transform • Each relative to its parent, forming a hierarchy • Last year we used matrices for this hierarchy • Now we have seen that matrices are not a good choice for animation in general • Expensive to interpolate & too much storage • So we decompose the transform into: • Rotation, translation, scale etc. • Use vectors for translation and scale • Quaternions for rotation

  7. Transformation Decomposition • Can write a quaternion-based transformation class • With the same functionality as a matrix class • But able to interpolate rotations efficiently • Use for current transformations of animated models – one for each bone in hierarchy • However, when storing keyframes, we can remove uneeded elements • E.g. no scaling – don’t store scaling • Will reduce the storage by 40% or so

  8. Key Frames • Key frames authored by artists • Based on needs of animation • Must make sure it suits our needs too: • Rotations small enough for interpolation method (e.g. nlerp) • No unsupported components (e.g. shear) • All bones key-framed at once or independently • Might pre-process keyframes: • Precalculate values (e.g. sin θ) • Add extra frames to improve motion when using approximations

  9. Interpolation Revisited • Choices with interpolation: • Use lerp or normalised lerp (nlerp) always • Or use slerp sometimes • Or use slerp approximations (sometimes) • First choice can be the best nlerp • Unless there are large angular movements in your animation (rare) • Less than 5% inaccurate for < 45 degrees

  10. Higher Order Interpolation • We may wish to use more complex interpolations: • To produce smooth curves • Higher order interpolation needs less key frames • Up to ten times less • Only a little extra data • Overall greatly aids our memory problem • Example: cubic Bezier curve formula • Use as a replacement for linear interpolation • Needs extra points to define curve

  11. Playing Animations • Each animation has a length • Usually measured in seconds • Within that time there will be several key frames • Around 0.5 to 8 per second - may not be evenly spread • Our model will know its current animation position • E.g. 1.2 seconds into an 2 second walk animation • Need a fast method to extract the which key frames are needed at this point • Need the frame before, the frame after and the interpolation value t

  12. Playing Animations • For each animation store a single structure: • Number of bones in animation • Length (in seconds) • Key frame data • When a model plays an animation it stores an additional structure: • Pointer to the animation it is using • Current position (time) in the animation • Can be converted to key frames + t value • Speed of playback • This way several models can use the same animation at the same time

  13. Blending Animations • Game characters often do several things at once: • E.g. Running and shooting • Many animations only use part of the body • E.g. A waving animation • Like to use different animations at the same time • And/or apply them only to parts of the body • Possible with further linear interpolation of several animations: • A first lerp to get pose 1, a second lerp to get pose 2 • Then a final lerp to blend these two together

  14. Multiway Blending • Can add weightings to the animations: FinalPose = Pose1 * w1 + Pose2 * w2 • If w1>w2, then Pose1 is more prominent • Almost identical to quaternion and vector linear interpolation from last week • Can blend more than two animations too • This is called multiway blending • Uses: • Smoothly changing from a run to a walk • Different animations for legs and upper body • Separate facial animations • All of the above happening at the same time

  15. Bone Masks • Can also have per-bone weights for blending animations - called a bone mask • For a waving animation, the bones in the arm would have a weight of 1.0 • The animation fully affects the arm • The rest of the body would have 0.0 • No effect on the body • Don’t need to store key frames for these parts • The shoulder would have a weight of 0.5 • Blending the waving animation with any underlying animation

  16. Motion Extraction • A run animation actually moves the character in the scene – even if our model is stationary • How to match the motion stored in the animation and the position of our models? • Use motion extraction techniques, generally: • Analyse movement of a root bone in the animation • Subtract that motion from the animation – so the animation doesn’t move • Replicate the movement onto our actual scene model • The result will look the same, but with the scene model tracking the animation root

  17. Animation Summary • Many aspects to a full animation system • A very intricate areas of games development • Only able to touch upon the issues in the time available here • Matrices, quaternions, interpolation are just the building blocks • Look at simple, but functional system in the labs • In the real world you will find more complex systems in use • But with the same principles

More Related