3D Graphics for Game Programming (J. Han) Chapter XI Character Animation.

Slides:



Advertisements
Similar presentations
Animation in Video Games presented by Jason Gregory
Advertisements

1 Characters. 2Introduction The Characters are the Actors of the Games. The Characters are the Actors of the Games. Three Types of Characters : Three.
Animation Following “Advanced Animation and Rendering Techniques” (chapter 15+16) By Agata Przybyszewska.
Lecture 2: linear algebra, animation basics
Character Setup Character Setup is the process of creating handles and controls for anything that a character animator will need to adjust in order to.
1Notes  Assignment 0 marks should be ready by tonight (hand back in class on Monday)
Jinxiang Chai CSCE441: Computer Graphics Coordinate & Composite Transformations 0.
Computer Graphics Recitation 2. 2 The plan today Learn about rotations in 2D and 3D. Representing rotations by quaternions.
3D orientation.
Kinematics. ILE5030 Computer Animation and Special Effects2 Kinematics The branch of mechanics concerned with the motions of objects without regard to.
CSCE 689: Computer Animation Rotation Representation and Interpolation
CSCE 441: Computer Graphics Rotation Representation and Interpolation
CSCE 641: Computer Graphics Rotation Representation and Interpolation Jinxiang Chai.
Animation. Outline  Key frame animation  Hierarchical animation  Inverse kinematics.
Midterm Review CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2004.
Week 4 Lecture 3: Character Animation Based on Interactive Computer Graphics (Angel) - Chapter 10 1 Angel: Interactive Computer Graphics 5E © Addison-Wesley.
CSE 473 Dr. Charles B. Owen Fundamentals of 3D Game Development1 Skeletons and Skinning Bones and Skeletons Mesh Skinning.
The linear algebra of Canadarm
An Introduction to Robot Kinematics
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology 3D Engines and Scene Graphs Spring 2012.
Characters.
Interactive Graphics Lecture 18: Slide 1 Interactive Computer Graphics Lecture 18 Kinematics and Animation.
Chapter 5.2 Character Animation. CS Overview Fundamental Concepts Animation Storage Playing Animations Blending Animations Motion Extraction Mesh.
Advanced Graphics (and Animation) Spring 2002
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Kinematic Linkages.
Key Frame Animation and Inverse Kinematics
CSC418 Computer Graphics n Animation Principles n Keyframe Animation.
Rotations and Translations
Week 5 - Wednesday.  What did we talk about last time?  Project 2  Normal transforms  Euler angles  Quaternions.
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Kinematic Linkages.
Character Animation for Realtime Applications Michael Putz Klaus Hufnagl Institute of Computer Graphics Graz University of Technology Austria.
Character Animation. Contents Keyframe animation Mocap Smooth skin by vertex blending Rigging & retargeting Gait analysis (Ragdoll physics) Fall
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Jinxiang Chai Composite Transformations and Forward Kinematics 0.
Manipulator’s Forward kinematics
Kinematics Jehee Lee Seoul National University. Kinematics How to animate skeletons (articulated figures) Kinematics is the study of motion without regard.
Maths & Technologies for Games Animation: Practicalities CO3303 Week 3.
CSE 381 – Advanced Game Programming Animation Systems Jack Skellington, from The Nightmare Before Christmas.
16/5/ :47 UML Computer Graphics Conceptual Model Application Model Application Program Graphics System Output Devices Input Devices API Function.
CS-378: Game Technology Lecture #13: Animation Prof. Okan Arikan University of Texas, Austin Thanks to James O’Brien, Steve Chenney, Zoran Popovic, Jessica.
What is Kinematics. Kinematics studies the motion of bodies.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
CS 450: COMPUTER GRAPHICS ANIMATION SPRING 2015 DR. MICHAEL J. REALE.
Comparing Two Motions Jehee Lee Seoul National University.
Geometric Transformations Sang Il Park Sejong University Many slides come from Jehee Lee’s.
1cs426-winter-2008 Notes. 2 Kinematics  The study of how things move  Usually boils down to describing the motion of articulated rigid figures Things.
Euler Angles This means, that we can represent an orientation with 3 numbers Assuming we limit ourselves to 3 rotations without successive rotations about.
Week 5 - Monday.  What did we talk about last time?  Lines and planes  Trigonometry  Transforms  Affine transforms  Rotation  Scaling  Shearing.
Jinxiang Chai CSCE441: Computer Graphics Coordinate & Composite Transformations 0.
CGDD 4003 Character Animation. The Skeletal Hierarchy (aka the “rig”) Based on the concept of bones Each bone has exactly one parent Each bone has a transform.
Sect. 4.5: Cayley-Klein Parameters 3 independent quantities are needed to specify a rigid body orientation. Most often, we choose them to be the Euler.
Robotic Arms and Matrices By Chris Wong and Chris Marino.
Character Animation Forward and Inverse Kinematics
COMPUTER GRAPHICS CHAPTER 35 CS 482 – Fall 2017 ANIMATION
CPSC 641: Computer Graphics Rotation Representation and Interpolation
Bones Skeletal Unity-2D How & When
CHAPTER 2 FORWARD KINEMATIC 1.
Introduction to manipulator kinematics
CSE4421/5324: Introduction to Robotics
Skeletons and Skinning
Computer Animation and Visualisation Lecture 4. Skinning
Chapter IV Spaces and Transforms
Chapter XIII Character Animation
Computer Animation Algorithms and Techniques
Prepared by: Engr . Syed Atir Iftikhar
UMBC Graphics for Games
CSCE441: Computer Graphics Coordinate & Composite Transformations
CSCE441: Computer Graphics 2D/3D Transformations
Chapter 2 Mathematical Analysis for Kinematics
Presentation transcript:

3D Graphics for Game Programming (J. Han) Chapter XI Character Animation

3D Graphics for Game Programming (J. Han) Keyframe Animation in 2D  In the traditional hand-drawn cartoon animation,  the senior key artist would draw the keyframes, and  the junior artist would fill the in-between frames.  The similar applies to computer animation. For a 30-fps animation, for example, much fewer than 30 frames are defined per second. They are the keyframes. In real-time computer animation, the in-between frames are automatically filled at run time.  The key data are assigned to the keyframes, and they are interpolated to generate the in-between frames. Any data that change in the time domain can be interpolated.

3D Graphics for Game Programming (J. Han) Euler Angles  Recall Euler angles and Euler transform.

3D Graphics for Game Programming (J. Han) Keyframe Animation in 3D  Keyframe animation in 3D: Seven teapot instances are defined by sampling the graphs seven times.

3D Graphics for Game Programming (J. Han) Keyframe Animation (cont’d)  Smoother animation may often be obtained using a higher-order interpolation.

3D Graphics for Game Programming (J. Han) A Problem of Euler Angles  A problem of Euler angles is that they are not always correctly interpolated.

3D Graphics for Game Programming (J. Han) Quaternion  A quaternion is an extended complex number.  Conjugate  Magnitude (If the magnitude of a quaternion is 1, it’s called a unit quaternion.)

3D Graphics for Game Programming (J. Han) Quaternion (cont’d)  Recall 2D rotation  Let us represent (x,y) by a complex number x+yi, and denote it by p.  Given the rotation angle , the polar form of a unit-length complex number is defined as cos  +sin  i. Let us denote it by q. Then, we have the following:  Surprisingly, the real and imaginary parts of pq represent the rotated coordinates.

3D Graphics for Game Programming (J. Han) Quaternion (cont’d)  3D rotation can be similarly described using quaternions.  Consider rotating a 3D vector p about an axis u by an angle . Both the vector to be rotated and the rotation are represented in quaternions.  Vector p to a quaternion p  The rotation axis u and rotation angle  define another quaternion q. (The axis u is divided by its length to make a unit vector u.)  Then, the rotated vector is equivalent to the imaginary part of.

3D Graphics for Game Programming (J. Han) Quaternion (cont’d)  Proof

3D Graphics for Game Programming (J. Han) Quaternion (cont’d)  Consider two unit quaternions, p and q, which represent rotations. They can be interpolated using parameter t in the range of [0,1]:  This is called spherical linear interpolation (slerp).  If quaternions are defined for the keyframes, they can be interpolated for the in-between frames.

3D Graphics for Game Programming (J. Han) Quaternion (cont’d)  Proof

3D Graphics for Game Programming (J. Han) Quaternion (cont’d)  A quaternion q representing a rotation can be converted into a matrix form. If q = (q x,q y,q z,q w ), the rotation matrix is defined as follows:  Conversely, given a rotation matrix, we can compute the corresponding quaternion.

3D Graphics for Game Programming (J. Han) Quaternion (cont’d)  Proof

3D Graphics for Game Programming (J. Han) Quaternion (cont’d)  Summary  A 3D rotation is represented in a quaternion.  Quaternions are well interpolated through spherical linear interpolation.  A quaternion can be converted into a rotation matrix.

3D Graphics for Game Programming (J. Han) Quaternion (cont’d)

3D Graphics for Game Programming (J. Han) Skeleton  A popular method for animating a character is to use a skeleton, which is composed of bones. The skeleton is embedded into the polygon mesh. When the skeleton is animated, the vertices of the polygon mesh will be accordingly animated.

3D Graphics for Game Programming (J. Han) Skeleton (cont’d)  Skeleton editing and embedding  The skeleton template such as 3ds Max biped is positioned in the default pose.  The bones are edited.  The skeleton is made to fit to the polygon mesh.

3D Graphics for Game Programming (J. Han) Skeleton (cont’d)

3D Graphics for Game Programming (J. Han) Skeleton (cont’d)

3D Graphics for Game Programming (J. Han) Space Change between Bones  The bones are connected at joints, which allow the rigid skeleton to animate in an articulated fashion. See the example, which consists of three bones (upper arm, forearm, and hand) and three joints (shoulder, elbow, and wrist).  When the forearm moves, for example, v f has to move accordingly. It is simply achieved if v f is defined in the forearm's object space.  Initially, all vertices of the default pose are defined in the object space of the character. To avoid confusion with the object space of a bone, let’s use the term, world space, instead of the character’s object space.  Every world-space vertex of the default pose needs to be transformed into the object space of the bone (which we call bone space henceforth) it belongs to. For example, v f will be transformed into the forearm's bone space so as to have the coordinates (2,0).

3D Graphics for Game Programming (J. Han) Space Change between Bones (cont’d)  For now, consider the opposite direction, i.e., from the bone space to the world space. If we can compute such a bone-to-world transform, its inverse can be used to convert a world-space vertex into the bone space.  Consider the to-parent transform of the forearm, which transforms a forearm vertex to the space of its parent.  Now consider the to-parent matrix of the hand.  Given a vertex at a bone, we can concatenate the to-parent matrices so as to transform the vertex into the bone space of any ancestor in the skeleton.

3D Graphics for Game Programming (J. Han) World Space to Bone Space  The root node (pelvis) is associated with a transform used to position and orient it in the world space for the default pose. It is an identity matrix because the world space is in fact the object space of the character. Let us denote the world matrix by M 1,d.  The spine's world transform  The clavicle’s world transform  Let’s generalize

3D Graphics for Game Programming (J. Han) World Space to Bone Space (cont’d)  So far, we have considered the world transform from the bone space to the world space. However, what is needed in an articulated-body animation is its inverse.  Once the default pose is fixed, the inverse world transforms can be computed for all bones.  In the default pose, M i,p -1 can be immediately obtained.  Computing M i,d -1 requires M i-1,d -1 to be computed in advance, and therefore the skeleton hierarchy is travdersed top down.

3D Graphics for Game Programming (J. Han) Forward Kinematics  The inverse of the world transform converts a world-space vertex “in the default pose” to the i-th bone's space.  Now the i-th bone is animated. Then, the vertices belonging to the bone are accordingly animated. The animation is often called local transform.  For rendering, the animated vertices should be transformed back to the world space. (Then, they will be transformed to the camera space and so forth, along the pipeline.) Let us call the transform matrix M 5,w.

3D Graphics for Game Programming (J. Han) Forward Kinematics (cont’d)  As the first step for computing the world-space position of “animated v 5,” let us find its coordinates in the upper arm's space.  The upper arm can also be animated. Let M 4,w denote the matrix that transforms the animated vertices of the upper arm into the world space. Then, M 5,w for transforming “animated v 5 ” into the world space is defined.  Let’s generalize.

3D Graphics for Game Programming (J. Han) Forward Kinematics (cont’d)  When the artist defines the animated pose of the i-th bone, M i,l is obtained.  M i,p was obtained from the default pose.  So, computing M i,w simply requires M i-1,w to be computed in advance.  M 1,w representing the pose of the animated pelvis is defined by the artist.  We can compute the world transforms of all bones “in the animated pose” also in the top-down fashion.  When v d and v w denote the world-space vertices “in the default pose” and “in the animated pose,” respectively, we have the following relation:

3D Graphics for Game Programming (J. Han)  When v 2 belongs to the forearm, M f,w M f,d -1 produces v 2 ´. Similarly, v 1 ´ and v 3 ´ can be produced.  In skinning, v 2 is transformed not only by M f,w M f,d -1 but also by M u,w M u,d -1. Then, the transformed vertices are interpolated using the predefined weights. The same applies to v 1 and v Skinning

3D Graphics for Game Programming (J. Han) Skinning (cont’d)  Suppose that w 5 and w 6 are equal.

3D Graphics for Game Programming (J. Han) Skinning in Keyframe Animation  Recall the following:  The local transform M i,l is an affine transform (usually a rotation).  The to-parent transform M i,p is a space-change matrix composed of a translation and a rotation.  Let us combine M i,l and M i,p into a single matrix and name it M c.  Its upper-left 3x3 sub-matrix represents a combined rotation.  Its fourth column represents a combined translation.  For a keyframe, the rotation part of M c is stored as a quaternion, and the translation is stored as a vector. They form the key data “of a bone.”  For an in-between frame, both the quaternions and translational vectors of the keyframes are interpolated.  The interpolated quaternion is converted into a matrix.  The interpolated translation vector fills the fourth column of the matrix, which can then be called the “interpolated M c.”  It is combined with the parent bone's world transform M i-1,w so as to complete M i,w. (For this purpose, top-down traversal is needed.)

3D Graphics for Game Programming (J. Han) Skinning in Keyframe Animation (cont’d)  The following CPU pseudo computes Mi, which is M i,w M i,d -1, and store it in the matrix palette.

3D Graphics for Game Programming (J. Han) Skinning in Keyframe Animation (cont’d)

3D Graphics for Game Programming (J. Han) Skinning in Keyframe Animation (cont’d)  The indices of MatrixIndex are three times the actual indices, e.g., not (0,2,7,18) but (0,6,21,54).

3D Graphics for Game Programming (J. Han) Skinning in Keyframe Animation (cont’d)

3D Graphics for Game Programming (J. Han) Motion Capture

3D Graphics for Game Programming (J. Han) Inverse Kinematics  In robotics, an end effector refers to the device located at the end of a robotic arm.  Forward kinematics computes the pose of the end effector as a function of the joint angles of the robotic arm.  The reverse process is called inverse kinematics (IK). Given the desired pose of the end effector along with the initial pose of the robotic arm, the joint angles of the final pose are calculated.  The number of independent variables defining the state of an object is called the degrees of freedom (DOF).

3D Graphics for Game Programming (J. Han) Inverse Kinematics - Analytic Solution

3D Graphics for Game Programming (J. Han) Inverse Kinematics - Cyclic Coordinate Descent

3D Graphics for Game Programming (J. Han) Inverse Kinematics - Example