# Lecture 008

## Basic Animation Technology

### 2D Animation

Particle system in modern game engine is also consists of sprite playback.

### Vertex Animation

Vertex animation is done by storing translation and rotation "texture" (Vertex Animation Texture or VAT) each frame for every vertex.

In a VAT, each row is a frame and each column is the animation for a specific vertex. The method is most flexible for complex morphing but requires massive data.

### Morph Target Animation

Morph Target Animation is a special kind of vertex animation that interpolates between frames (key frame LERP).

### 3D Skinned Animation

We need a water tight animation for expressing bonned structure like animals.

The same logic hold for 2D skinned animation.

For easy-reuse of animation, we developed some standard skeleton hierarchy

Joint: has 6 degree of freedom (or sometimes 9 with inclusion of zoom and scale in 3 direction)

• although the position and scale seldom change, it has special applications

Bones: in between two joints

In real game development, artists need to define normal joints for humanoid characters. For specific characters, facial or wings might have more joints, but still compatible with basic humanoid definition.

Additional joints are used to attach vehicles and weapons.

There are two joints that is essential:

• Pelvis Joint: center of mass

• Root Joint: zero position of object

When artists bind model and bones, they often use a standard "zero-point" pose. Traditionally we use "T" pose. However, "T" pose is rather unnatural and will result lower precision in most standing position. "A" pose is commonly used for better precision in production.

#### Rotation Representation

Rotation in Euler Angle has many problems:

• applying rotation must be ordered

• Gimbal lock

• hard to calculate in rotation in the direction of any axis

• difficult to interpolate correctly

Gimbal lock can be useful in camera stabilization and gyroscope for localization by integrating over gyroscope output.

Group Theory (SO3) proved that Quaternion will work only in 3D rotation.

Unlike screen projection, affine transformation has always 0s in the last row because we do not need projection.

We store transformation matrix in local space as it is natural for linear interpolation.

#### Skinning Matrix

Skinning Matrix: a transformation matrix from

In animation, we interpolate the transformation from father vertext to current animated vertex. In binding, we store the same transformation. Therefore, to calculate a frame, we need to first know the product of all transmation from the root to leaf, then apply inverse transformation of binding matrix, then apply inputting matrix that is the result of interpolation. We combine the inverse of binding matrix and the large matrix product into skinning matrix for easier calculation. Every vertex is associated with one sinning matrix. (Often the calculation also involves world position matrix)

This allow us to avoid calculation for every mesh vertex since we have way less joints than mesh vertex in one animation frame.

A mesh vertex can follow and joints with some percentage. The interpolation should be in the model space (not local space).

Some AI-based method can generate skinning for artists, although not perfect.

We can also do interpolation between frames. Linear interpolation is enough for scale and translation. But we need to do normalized lerp (NLERP) for rotation.

Since Quaternion Interpolation can be achieved in 2 ways, we need to pick the shortest path. SLERP: Uniform Quaternion Rotation Interpolation. This fixes the speed in which rotation should interpolate.

In practice:

• when the angle is small, to avoid inverse trig function, use NLERP

• when the angle is large, use SLERP

#### Compressing Animation

Reducing Animation Size:

• removing scale

• removing translation

Keyframe Removal: removes keyframe that could be accurately represented by some sort of interpolation. Catmull-Rome Spline: Knowing P0, P1, P2, P3 will result a good smooth curve from P1 to P2

Float Quantization: You can further compress quaternion matrix. One property of quaternion matrix is that if the largest component is $1$, then all other components must be in the range of $[-\frac{1}{\sqrt{2}}, \frac{1}{\sqrt{2}}]$. This means that we can use $2$ bits to store the position of the largest component, and then normalize all other components for better floating point precision.

Simple Error Calculation: we only care about joints

• Translation Error: $\|T_1 - T_2\|$

• Rotation Error: $\|R_1 - R_2\|$

• Scale Error: $\|S_1 - S_2\|$

Visual Error Calculation: we care about vertices that are attached on joints. But since computation is too hard, we make fake vertices to estimate error.

Error Compensation: one intuitive way is adjust the orientation of child vertex to compensate for error in parent vertex. However, this will result high frequency signal and shakes in child vertex.

### Physics-based Animation

Use case:

• Ragdoll System: for dieing animation

• Cloth and Fluid Simulation: cloth and water simulation

• Inverse Kinemetic: climbing physics simulation

### Animation Content Creation

Two methods:

• k-frame animation

• motion capture