Presentation is loading. Please wait.

Presentation is loading. Please wait.

Key Frame Animation and Inverse Kinematics

Similar presentations


Presentation on theme: "Key Frame Animation and Inverse Kinematics"— Presentation transcript:

1 Key Frame Animation and Inverse Kinematics

2 Introduction Key frame animation requires an artist to build a character in various poses Each pose is called a key frame Each key frame changes the local positions and local orientations of the nodes in the hierarchy To animate the character, the poses at the times between key frames are computed using interpolation. Character Models are rich, complex hair, clothes (particle systems), muscles, skin (FFD’s etc.) Focus is rigid-body, joint angles

3 Key-frame animation Kinematics: how the positions of the parts vary as a function of the joint angles. Dynamics: how the positions of the parts vary as a function of applied forces. Each joint specified at various key frames (not necessarily the same as other joints) System does interpolation or in-betweening Doing this well requires: A way of smoothly interpolating key frames: splines A good interactive system A lot of skill on the part of the animator

4 Key-frame animation To specify a pose, we specify the joint-angle rotations Each joint can have up to three rotational DOFs Kinematics: how the positions of the parts vary as a function of the joint angles. 1 DOF: knee 2 DOF: wrist 3 DOF: arm

5 Key-frame animation Links and Joints
An articulated figure is a construction made of links and joints. A link can be thought of as a solid rod. A joint can be thought of as a connection between two neighboring links. A joint might have several degrees of freedom, i.e., it might rotate around one, two, or three axes, or it might translate along one, two, or three axes Links and joints can be numbered from 1, …,N

6 Key-frame animation Paired Joints Coordinates
An articulated figure can be described using the pared joint coordinates method [R. Featherstone, Robot Dynamics Algorithms,1998] For each link three coordinate systems are associated: Body frame (BFi), associated with the center of mass of linki Inner frame (IFi), associated with jointi Outer frame (OFi), associated with jointi+1

7 BFiTIFi = TIFi (rIFi) RIFi (IFi,uIFi)
Key-frame animation The Transformation BFiTIFi The problem is: given a point p = [x,y,z]T in inner frame coordinates, determine its coordinates in the body frame. In homogeneous coordinates the transformation from the inner frame to the body frame is given by a matrix BFiTIFi = TIFi (rIFi) RIFi (IFi,uIFi) The translation and rotation matrices are as follows TIFi (rIFi) = RIFi (IFi,uIFi) = where the symbol 1 denotes a 3x3 identity matrix, and the vectors IIFi, jIFi, kIFi,and 0 are 3x1 column vectors

8 Forward and Inverse Kinematics
Euler angles - An Euler angle is a rotation about a single Cartesian axis - Create multi-DOF rotations by concatenating Eulers Singularities in Euler Angles - Cannot be avoided (occur at 0° or 90°) - Difficult to work around What is a singularity? - continuous subspace of parameter space all of whose elements map to same rotation Why is this bad? - induces gumball lock - two or more axes align, results in loss of rotational DOFs (i.e. derivatives)

9 Forward and Inverse Kinematics
Kinematics is the study of motion without considerations of mass or forces. Given a planar polyline consisting of a sequence of line segments, with each segment starting at Pi, having a unit-length direction Ui, and length Li for 0  i < n, and last segment terminating at Pn The forward kinematics problem is to compute Pn in terms of the known direction vectors and lengths

10 Forward and Inverse Kinematics
The final point of each segment is related to its starting point by Pi = Pi + Li Ui for 0  i < n. Summing over all i and canceling the common terms leads to the end effector formula Pn = Pn Li Ui Each direction vector can be viewed as an incremental rotation of the previous direction Ui = (cos( j), sin( j)).

11 Pn()= P0 + Li(cos( j),sin( j)).
Inverse Kinematics The angles i are called the joint angles of the manipulator. Using notation  = (0, …, n-1), the end effector can be written as a function Pn()= P Li(cos( j),sin( j)). The inverse kinematics problem is to select the position G for the end effector and determine joint angles so  that Pn() = G. The point G is called the goal and might not always be attainable.

12 Inverse Kinematics Numerical Solution by Jacobian Methods
Closed-form solutions are usually not possible and numerical methods are better choice for attempting to find solutions Consider a manipulator that is a polyline with a single end effector.

13 Inverse Kinematics Numerical Solution by Jacobian Methods
Let the end effector be written as P = F() The derivative of the end effector position with respect to each joint parameter be used to determine an incremental step in joint space that will (hopefully) move the end effector closer to the goal. If the position of the end effector is a function of time t, the derivatives are dP/dt = DFd/dt DF is the Jacobian of F, the matrix of first-order partial derivatives

14 G – P = G - F() as an approximation,
Inverse Kinematics Numerical Solution by Jacobian Methods If G is the goal and if dP/dt is replaced by G – P = G - F() as an approximation, then the numerical method is to use G - F() = DF()d/dt to update  from its current value. The Jacobian matrix is (usually) not square, so its inverse is not defined.

15 d/dt = DF+()(G - F())
Inverse Kinematics Numerical Solution by Jacobian Methods Given a nonsquare matrix M, its pseudoinverse is defined to be M+ =Mt (MM t) -1, where M+M = I, the identity matrix. Applying the pseudoinverse of the Jacobian yields d/dt = DF+()(G - F()) Given a current value of , this equation allows an update by using a forward difference operator to approximate the time derivative of the joint angles.

16 Inverse Kinematics Numerical Solution by Jacobian Methods
The scheme is applied iteratively until some stopping criterion is met. This approach is not always the best one since computing the pseudoinverse is expensive, moreover, sometimes the Jacobian is singular on its domain or ill-conditioned, so numerical problems arise in the inversion. More general approach is to use already existing algorithms for optimization. The idea is to minimize a quadratic function of the error E() = G - F()2 with respect to .

17 Motion Interpolation Key-Framing
In practice, it is not easy for animator to specify all the joint parameters as functions of time, that is, 1, 2,…, n A helpful tool is to specify the joint parameters by using what is known as key-frames. The animator only has to specify the most important configurations of the articulated figure and also at what time ti they occur, see Figure.

18 Motion Interpolation Key Frames
Having specified the key-frames, that is, the joint parameters at some discrete times ti, the joint parameters at the key-frames can be plotted on timeline, see Figure.

19 Motion Interpolation Key Frames: Linear Interpolation
If linear interpolation is used, the functions that represent the joint parameters are look like the ones shown in Figure.

20 Motion Interpolation Key Frames: Spline Interpolation
In order to ger a smooth function for the joint parameters, we use the parametrs at the key-frames as points that must be interpolated.

21 Motion Interpolation Key Frames: Spline Interpolation
How much the spline bends and wiggles depends on which type of spline and how many control points are use.

22 Interpolating the local translations
Kochanek-Bartels splines Given an ordered list of points {pi}ni=0, the KBS provide a cubic interpolation between each pair pi and pi+1 with varying properties specified at the end points. These properties are tension , which controls how sharply the curve bends at a control point; continuity , which provides a smooth visual variation in the continuity at a control point; and a bias , which controls the direction of the path at a control point.

23 Interpolating the local translations
Kochanek-Bartels splines use Hermite interpolation basis H0(t) = 2t3 – 3t2 + 1, H1(t) = -2t3 – 3t2 , H2(t) = t3 – 2t2 + t, and H3(t) = t3 – t2 . A parametric cubic curve passing through points pi and pi+1 with tangent vectors Ti and Vi+1, respectively, is xi(t) = H0(t) pi + H1(t) pi+1 + H2(t) Ti + H3(t) Ti+1, where 0  t  1.

24 Interpolating the local translations
Kochanek-Bartels splines Parameters  = 0,  = 0,  = 0. fish8_tr.avi

25 Key frame animation: Quaternions
A quaternion invented by Sir William Rowan Hamilton in 1843 is given by q = w + xi + yj +zk, where w, x, y, z are real numbers and i, j, k are primitive elements. Multiplication for them is defined by i2 = j2 = k2 = -1, ij = -ji = k, jk = -kj = i, and ki = -ik = j. A unit quaternion is a quaternion q for which the norm of the quaternion N(q) = w2 + x2 + y2 + z2 = 1. A unit quaternion can be represented by q = cos + usin, where u = u0i + u1j + u2k and vector (u0,u1,u2) has length 1. It is possible to define the logarithm of a unit quaternion, log(q) = log(cos + usin) = log*exp(u) = u. A unit quaternion q = cos + usin represents the rotation of 3D vector v by an angle 2 about the 3D axis u

26 Key frame animation Spherical Linear Interpolation
Given two distinct points on a unit sphere in 3D space, it is possible to interpolate between them by sampling along a great arc containing the two points. To constrain the formula , let q0 and q1 be distinct unit vectors on a hypersphere. An interpolation is required of the form q(t) = c0(t)q0 + c1(t)q1, 0  t  1, where c0(t) and c1(t) are real-valued functions and q(t) is always a unit vector.


Download ppt "Key Frame Animation and Inverse Kinematics"

Similar presentations


Ads by Google