Morph Target Animation / Quaternions
Dr Anton Gerdelan gerdela@scss.tcd.ie

About Me

  • Working on smart buildings EU project with WebGL visualisation
  • Lectured in Karlskrona, Sweden. 3d programming, games, visualisation
  • Did most of PhD with GV2. Vehicle simulation, AI, graphics.
  • Have a sort of blog about WebGL project and 3d stuff https://antongerdelan.net/

Morph Target Animation

  • Alternative to skinning/skeletal animation
  • Good for detailed, "squishy" animations like faces, explosions, voluminous liquids, transformers...
  • Can be hooked up with lip sync etc. "ah" "oh" "bee" etc.
  • Technical artist creates copies of mesh in several "target" poses
  • Our code blends smoothly between targets via linear interpolation
  • Can blend final pose from several targets; neutral, happy, sad, eyes left, eyebrows...

image source: "Shape Keys", wiki.blender.org

Here's One That I Prepared Earlier

Interpolation of Targets

// assume we have set weights for happy and sad faces and have meshes
// work out how much of "neutral" pose to show
float w_neutral = 1.0 - w_happy - w_sad;
clamp (w_neutral, 0.0, 1.0);

// get each weight as a factor of total of weights
float w_sum = w_happy + w_sad + w_neutral;
float happy_factor = w_happy / w_sum;
float sad_factor = w_sad / w_sum;
float neutral_factor = w_neutral / w_sum;

// work out final position by doing weighted average of each target
vec3 mixed_xyz = mix (default_pos, happy_pos, happy_factor);
mixed_xyz = mix (mixed_xyz, sad_pos, sad_factor);

Quick Intro to Quaternions

  • Very hard to get a simple explanation ... until now
  • Contriving a rotation from Rz * Ry * Rx matrices
    • is cumbersome (order is important)
    • some representations can have issues at extreme angles
  • 1843. Enter: William Rowan Hamilton. Brougham Bridge (Royal Canal).
  • Extension of complex numbers that gives us an elegant way of representing 3d rotations
  • Can represent rotation between any 2 poses with 1 quaternion
  • Some nice methods for interpolating. Think skeleton hierarchy or IK
Studied at Trinity

Rotation Quaternion

Step 1: Build a Versor

When Ready: Quaternion to Matrix

Ref: Ken Shoemake, "Animating Rotation with Quaternion Curves", SIGGRAPH '85.

Re-normalise Quaternion

Ref: http://www.cprogramming.com/tutorial/3d/quaternions.html

Combine Rotations with Quaternion Multiplication

Interpolation with LERP and SLERP


Ref: Code discussion; Jonathan Blow, "Understanding Slerp, Then Not Using It" (Google it)

Issues with Skinning (Forward and Inverse Kinematics)