Geometric Skinning

Skinning is the process of controlling deformations of given objects using a set of deformation primitives (such as rigid transformations associated with bones of an animation skeleton of a video game character) [1].

There are 4 different approaches for skinning: [2]

  • Physically based methods: Realistic but, computation is costly.
  • Capturing real subjects: One of the frequently used methods. Highly accurate but, requires expensive hardware, and lots of example subject
  • Example based techniques: Still realistic than geometric skinning but, requires costly computation.
  • Geometric Skinning: De facto standard in video games. Computation is fast and easy. Generates results with acceptable realism.

Linear Blend Skinning (LBS), and Dual Quaternion Skinning (DQS) are two well known and frequently used geometric skinning algorithms. Both of them apply same logic for skinning; however, LBS blends transformations, and DQS blends dual quaternions.

Linear Blend Skinning (LBS)

LBS a.k.a. matrix palette skinning, skeleton-subspace deformation, enveloping is the most well know, and easy to apply geometric (direct) skinning approach. It computes the deformations using closed-form expressions without any numerical optimization [1]. LBS is a fast and easy to parallel for GPU implementation.

LBS takes rest pose shape, bone transformations, and skinning weights as inputs.

Rest pose shape is represented as a polygon mesh. Mesh connectivity is constant, and only vertex position may change in every frame. Rest pose vertices are shown in R^3 or R^4.

Animations are defined by bone transformations in R^4.

Bone weights represent the influence of the bone on a a vertex. Weights are in R. Each weight has to be in [0,1] range, and sum of all the weights has to be equal to 1.

In short, for LBS, we need vertices, bone structure (skeleton), weights that tell the relation between bones and vertices, and animation transformations.

LBS has an easy to understand equation [1] where w is skinning weights, T is transformations, V is skin vertex position and V’ is world-space vertex position.

LBS-EQ

LBS gives good results in low level quality and for the characters such as robots, mechanical characters, vehicles. It does not generate such good results for the organic characters such as human. Because, the transformation matrix may include some non-rigid transformations such as scale and shear that cause candy-wrapper effect (Because LBS uses linear interpolation).

REMINDER: Rigid (orthonormal) transformations are rotation, and translation. Non-rigid transformations are scale, and shares. For non-rigid transformations, blended matrix M (M = (B^-1)*w -Forward kinematics calculations)  could not be used. Inverse-transpose of M should be used. For rigid transformations, inverse-transpose of M is equal to M.

LBS process does not calculate only vertex positions. Normals and tangent vectors are also calculated for shading operations in the same manner. Same skinning weights/blended transformations are used for converting vertex normals to world-space normals with the same equation.

The only difference is the normals should be normalised after the calculations. Also, when the normals are converted to 4D homogeneous coordinates, 0 is used because normals represent direction,and 0 saves them translation effects. During the conversion, 1 is used for vertices.

This means normals are represented as N = [Nx, Ny, Nz, 0], and vertices are represented as V = [Vx, Vy, Vz, 1] in 4D homogeneous coordinates.

Tangent vectors are also calculated in the same manner. Tangent vectors are used for advanced shading techniques, anisotropic lighting, bump and displacement mapping. They do not require inverse-transpose of blended matrix M for their calculations. Tangent vectors are represented as T = [Tx, Ty, Tz, 0] in 4D homogeneous coordinates, and needed to normalize after world-space calculations (LBS operations).

LBS Algorithm

  1. Read related inputs
  2. Calculate absolute (global) transforms for all bones in the skeleton by multiplying their local transforms with parent’s transform
  3. Using absolute transforms, generate bind pose matrix, and calculate its inverse matrix. This step (Step 3) is done once after rest pose information is read. Later, inverse bind pose matrix is used for transformation matrix that is used for generating blend matrix on GPU.
  4. Calculate animation matrix (transformation matrix) by multiplying absolute transforms with inverse bind pose matrix. This step (Step 4) has to be done for each animation frame. In each frame, absolute transforms of the bones and animation matrix are recalculated.
  5. Send animation matrix to GPU for blending the transforms, and calculating vertex positions and normals.
  6. Calculate vertex position and normals by multiplying bone matrix, given vertex/normal and blend weight (Don’t forget to add previous results and normalize the normal). This step (Step 6) is done in GPU.

Steps until Step 5 are done on CPU. Step 5 and 6 are done on GPU.

For more details, UCSD’s CSE 169: Computer Animation course page, and Smooth Skinning Decomposition with Rigid Bones presentation by Binh Huy Le and Zhigang Deng can be checked.

Dual Quaternion Skinning (DQS)

DQS is also known as smooth skinning, and skeletal subspace deformation (SSD). Even if DQS has a harder mathematical background because of using dual quaternions, it can be applied as easy and fast as LBS.

DQS uses spherical interpolation (SLERP) instead of linear interpolation, and does not suffer from mesh shrinkage because of SLERP. Also, DQS blends dual quaternions instead of blending transformations. It computes a new dual quaternion that guarantees to represent only rotation and translation. This means there will not be a scale factor, and in this way shrinkage never happens around the joints.

This might be also a drawback. Because of not having scale factor, DQS cannot handle scale and shear operations, can be used only for rigid transformations. For scale and shear, additional implementation steps are required.

Before working with/study on DQS, taking a look at quaternions and dual quaternions will help a lot. Because, implementation of DQS requires dual quaternion representation (with 8 float member/variable), 4X4 matrix conversion to dual quaternion, some dual quaternion operations, and transformation applying of dual quaternion to a vertex.

DQS applies same blending logic as LBS does. The only difference is that DQS uses dual quaternion linear blending (DLB), and blends by using dual quaternions and the weights. DLB equation [2] can be seen below:

DLB Equation

For using DQS, the skinning matrices should be turned into dual quaternions. This operation is done on CPU. This step only includes quaternion multiplication and it does not take long time.

Blending operations (DLB) is done on GPU. Blending operation (numerator in DLB equation) is straightforward; however, normalization part (denominator in DLB equation) can be optimized.

Finally, blended dual quaternions are converted into blended matrix M, and using M matrix, vertex positions, and normals are calculated in the same manner as LBS ( V’ = MV, and N’ = MN).

DQS Algorithm

  1. Read related inputs
  2. Calculate absolute (global) transforms for all bones in the skeleton by multiplying their local transforms with parent’s transform
  3. Using absolute transforms, generate bind pose matrix, and calculate its inverse matrix. This step (Step 3) is done once after rest pose information is read.
  4. Calculate animation matrix (transformation matrix) by multiplying absolute transforms with inverse bind pose matrix. This step (Step 4) has to be done for each animation frame. In each frame, absolute transforms of the bones and animation matrix are recalculated. After animation matrix is calculated, it is converted into dual quaternions, and sent to GPU for blending operation.
  5. Shortest paths are found for the rotation.
  6. Dual quaternions are blended using DLB equation.
  7. Blended dual quaternions are converted into skinning matrix.
  8. Vertex positions and normals are calculated by using skinning matrix.

First 4 steps are done on CPU. The rest are done on GPU.

For more details, Dual Quaternions for Rigid Transformation BlendingSkinning with Dual Quaternions or Geometric Skinning with Approximate Dual Quaternion Blending by Kavan et al., and Ladislav Kavan’s Skinning with Dual Quaternions page can be checked.

References

[1]: SIGGRAPH Course 2014 – Skinning: Real-time Shape Deformation, Part I: Direct Skinning Methods and Deformation Primitives by Ladislav Kavan

[2]: Skinning with Dual Quaternion by Kavan et al.