Transcript Animation of complex objects
Key Frame Animation and Inverse Kinematics
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
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
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
Key-frame animation
Links and Joints An
links articulated figure
and
joints
.
is a construction made of 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
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
(BF i ), associated with the center of mass of link i
Inner frame Outer frame
(IF i ), associated with joint i (OF i ), associated with joint i+1
Key-frame animation
The Transformation BFi
T
IF
i
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
BFi T IFi
=
T IFi
(r
IFi
)
R IFi
(
IFi ,u IFi
) The translation and rotation matrices are as follows
T IFi R IFi
(r
IFi
) = (
IFi ,u IFi
) = where the symbol 1 denotes a 3x3 identity matrix, and the vectors
I IFi
,
k IFi
, and 0 are 3x1 column vectors
j IFi
,
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)
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 P i , having a unit length direction U i , and length L i for 0 i < n, and last segment terminating at P n The forward kinematics problem is to compute P n of the known direction vectors and lengths in terms
Forward and Inverse Kinematics
The final point of each segment is related to its starting point by P i = P i + L i U i for 0 i < n.
Summing over all
i
and canceling the common terms leads to the end effector formula P n = P n + L i U i Each direction vector can be viewed as an incremental rotation of the previous direction U i = (cos( j ), sin( j )).
Inverse Kinematics
The angles i are called the manipulator. Using notation
joint angles
= ( 0 , …, end effector can be written as a function of the n-1 ), the P
n (
)=
P
0 + L i (cos(
j ),sin(
j )).
The
inverse kinematics
problem is to select the position G for the end effector and determine joint angles so that P n ( ) = G.
The point G is called the goal and might not always be attainable.
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.
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 partial derivatives of F, the matrix of first-order
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.
Inverse Kinematics
Numerical Solution by Jacobian Methods Given a nonsquare matrix M, its pseudoinverse is defined to be M + =M t (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.
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 .
Motion Interpolation
Key-Framing In practice, it is not easy for animator to specify all the joint parameters as functions of time, that is, n 1 , 2 ,…, 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
t
i they occur, see Figure.
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.
Motion Interpolation
Key Frames: Interpolation Linear If linear interpolation is used, the functions that represent the joint parameters are look like the ones shown in Figure.
Motion Interpolation
Key Frames: Interpolation Spline 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.
Motion Interpolation
Key Frames: Interpolation Spline How much the spline bends and wiggles depends on which type of spline and how many control points are use.
Interpolating the local translations
Kochanek-Bartels splines Given an ordered list of points {p i } n i =0, the KBS provide a interpolation between each pair p i and p i+1 cubic 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.
Interpolating the local translations
Kochanek-Bartels splines use
Hermite interpolation basis H 0 (t) = 2t 3 H 2 (t) = t 3 – 3t 2 + 1, H 1 (t) = -2t 3 – 2t 2 + t, and H 3 (t) = t 3 – 3t 2 – t 2 , . A parametric cubic curve passing through points p i tangent vectors T i and V i+1 , respectively, is and p i+1 x i (t) = H 0 (t) p i + H 1 (t) p i+1 + H 2 (t) T i + H 3 (t) T i+1 , where 0 t 1.
with
Interpolating the local translations
Kochanek-Bartels splines Parameters = 0, = 0, = 0.
fish8_tr.avi
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 i and ki = -ik = j.
2 = j 2 = k 2 = -1, ij = -ji = k, jk = -kj = i, A
unit quaternion
is a quaternion q for which the norm of the quaternion N(q) = w 2 + x 2 + y 2 + z 2 = 1. A unit quaternion can be represented by q = cos + usin , where u = u 0 i + u 1 j + u 2 k and vector (u 0 ,u 1 ,u 2 ) has length 1.
It is possible to define the logarithm of a unit quaternion, log(q) = log(cos A unit quaternion q = cos by an angle 2 + usin ) = log*exp(u ) = u .
+ usin about the 3D axis u represents the rotation of 3D vector v
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 q 0 and q 1 be distinct unit vectors on a hypersphere. An interpolation is required of the form q(t) = c 0 (t)q 0 + c 1 (t)q 1 , 0 t 1, where c 0 (t) and c 1 (t) are real-valued functions and q(t) is always a unit vector.