8 Skinning

8.1 Implementation

This section describes the technical details of the ArtiSynth skinning mechanism. A skin mesh is implemented using a SkinMeshBody, which contains a base mesh and references to a set of underlying dynamic master bodies. A master body can be either a Frame (of which RigidBody is a subclass), or a FemModel3d. The positions of the mesh vertices (along with markers and other points that can be attached to the skin mesh) are determined by a weighted sum of influences from each of the m master bodies, such that as the latter move and/or deform, the vertices and attached points deform as well. More precisely, for each master body k,k\in\{0,\ldots,m-1\}, let w_{k} be the weighting factor and f_{k}({\bf q}_{k}) the connection function that describes the contribution of body k to the position of the vertices (or attached points) as a function of its generalized coordinates {\bf q}_{k}. Then if the position of a vertex (or attached point) is denoted by {\bf p} and its initial (or base) position is {\bf p}_{0}, we have

{\bf p}=\sum_{k=0}^{m-1}w_{k}f_{k}({\bf q}_{k})+w_{m}{\bf p}_{0}. (8.1)

The weight w_{m} in the last term is known as the base weight and describes an optional contribution from the base position {\bf p}_{0}. Usually w_{m}=0, unless the vertex is not connected to any master bodies, in which case w_{m}=1, so that the vertex is anchored to its initial position.

In general, connection weights w_{k} are computed based on the distances d_{k} between the vertex (or attached point) and each master body k. More details on this are given in Sections 8.2 and 8.3.

For Frame master bodies, the connection function is one associated with various rigid body skinning techniques known in the literature. These include linear, linear dual quaternion, and iterative dual quaternion skinning. Which technique is used is determined by the frameBlending property of the SkinMeshBody, which can be queried or set in code using the methods

  FrameBlending getFrameBlending()
  void setFrameBlending (FrameBlending blending)

where FrameBlending is an enumerated type defined by SkinMeshBody with the following values:


Linear blending, in which the connection function f_{k}() implements a standard rigid connection between the vertex and the frame coordinates. Let the frame’s generalized coordinates {\bf q}_{k} be given by the 3\times 3 rotation matrix {\bf R} and translation vector {\bf p}_{F} describing its pose, with its initial pose given by {\bf R}_{0} and {\bf p}_{F0}. The connection function f_{k}() then takes the form

f_{k}({\bf R},{\bf p}_{F})={\bf R}{\bf R}_{0}^{T}({\bf p}_{0}-{\bf p}_{F0})+{%
\bf p}_{F}. (8.2)

Linear blending is faster than other blending techniques but is more prone to pinching and creasing artifacts in the presence of large rotations between frames.


Linear dual quaternion blending, which is more computationally expensive but typically gives better results than linear blending, and is described in detail as DLB in [5]. Let the frame’s generalized coordinates {\bf q}_{k} be given by the dual-quaternion \hat{\bf q}_{k} (describing both rotation and translation), with the initial pose given by the dual-quaternion \hat{\bf q}_{k0}. Then define the relative dual-quaternion \tilde{\bf q}_{k} as

\tilde{\bf q}_{k}=\frac{\hat{\bf q}_{k}\hat{\bf q}_{k0}^{-1}}{\|\sum_{j}w_{j}%
\hat{\bf q}_{j}\hat{\bf q}_{j0}^{-1}\|}, (8.3)

where the denominator is formed by summing over all master bodies j which are frames. The connection function f_{k}() is then given by

{\bf f}_{k}(\hat{\bf q}_{k})=\tilde{\bf q}_{k}{\bf p}_{0}\tilde{\bf q}_{k}^{-1%
}-{\bf p}_{0}, (8.4)

where we note that a dual quaternion multiplied by a position vector yields a position vector.


Dual quaternion iterative blending, which is a more complex dual quaternion technique described in detail as DIB in [5]. The connection function for iterative dual quaternion blending involves an iterative process and is not described here. It also does not conform to (8.1), because the connection functions f_{k}() for the Frame master bodies do not combine linearly. Instead, if there are r Frame master bodies, there is a single connection function

f(w_{0},\ldots,w_{r-1},\hat{\bf q}_{0},\ldots,\hat{\bf q}_{r-1}) (8.5)

that determines the connection for all of them, given their weighting factors w_{j} and generalized coordinates \hat{\bf q}_{j}. Iterative blending relies on two parameters: a blend tolerance, and a maximum number of blend steps, both of which are controlled by the SkinMeshBody properties DQBlendTolerance and DQMaxBlendSteps, which have default values of 1^{-8} and 3.

Iterative dual quaternion blending is not completely supported in ArtiSynth. In particular, because of its complexity, the associated force and velocity mappings are computed using the simpler computations employed for linear dual quaternion blending. For the examples shown in this chapter, iterative dual quaternion gives results that are quite close to those of linear dual quaternion blending.

For FEM master bodies, the connection works by tying each vertex (or attached point) to a specific FEM element using a fixed-length offset vector {\bf d} that rotates in conjunction with the element. This is illustrated in Figure 8.2 for the case of a single FEM master body. Starting with the initial vertex position {\bf p}_{0}, we find the nearest point {\bf p}_{e0} on the nearest FEM element, along with the offset vector {\bf d}_{0}\equiv{\bf p}_{0}-{\bf p}_{e0}. The point {\bf p}_{e0} can be expressed as the weighted sum of the initial element nodal positions {\bf x}_{j0},

{\bf p}_{e0}=\sum_{j=0}^{n-1}\alpha_{j}{\bf x}_{j0}, (8.6)

where n is the number of nodes and \alpha_{j} represent the (constant) nodal coordinates. As the element moves and deforms, the element point {\bf p}_{e} moves with the nodal positions {\bf x}_{j} according to the same relationship, while the offset vector {\bf d} rotates according to {\bf d}={\bf R}_{E}d_{0}, where {\bf R}_{E} is the rotation of the element’s coordinate frame E with respect to its initial orientation. The connection function f_{k}() then takes the form

f_{k}({\bf x}_{0},\ldots,{\bf x}_{n-1})=\sum_{j=0}^{n-1}\alpha_{j}{\bf x}_{j}+%
{\bf R}_{E}d_{0}. (8.7)

{\bf R}_{E} is determined by computing a polar decomposition {\bf F}={\bf R}_{E}{\bf P} on the deformation gradient {\bf F} at the element’s center. We note that the displacement {\bf d} is only rotated and so the distance \|{\bf d}\|=\|{\bf d}_{0}\| of the vertex from the element remains constant. If the vertex is initially on or inside the element, then {\bf d}_{0}=0 and (8.7) takes the form of a standard point/element attachment as described in 6.4.3.

Figure 8.2: Illustration of FEM skinning, showing how a position {\bf p} is tied to an FEM element. Given the initial position {\bf p}_{0}, we find the nearest point {\bf p}_{e0} on the element, along with the offset vector {\bf d}_{0}={\bf p}_{0}-{\bf p}_{e0} (left). As the element moves and deforms, the updated position is obtained from {\bf p}={\bf p}_{e}+{\bf d}, where {\bf p}_{e} deforms with the element, and {\bf d} rotates in tandem with its coordinate frame E.

While it is sometimes possible to determine weights \alpha_{j} that control a vertex position outside an element, without the need for an offset vector {\bf d}, the resulting vertex positions tend to be very sensitive to element distortions, particularly when the vertex is located at some distance. Keeping the element-vertex distance constant via an offset vector usually results in more plausible skinning behavior.