Game Development Reference
In-Depth Information
//Now we can overwrite original positions
for (eachVertex)
vertex.pos = vertex.newPos;
}
Listing 13.5. In a preprocessing step we compile a list of neighbor vertices for each vertex
in the mesh. Then we iterate over the vertices and move each to the average position of its
neighbors. Sufficient iterations of the outer loop will deform the mesh into its Laplacian
shape.
In practice, three to five iterations of this algorithm is sufficient to approach the
limit shape. This algorithm can destroy fine detail and works best on meshes that
have relatively evenly distributed edge loops at rest pose (a generally favorable
property for most deformation algorithms).
Because it is destructive, in the sense that it will smooth away detail in the
rest pose, Laplacian smoothing must be supplied with per-vertex weights to limit
its influence on locally defined regions. With the addition of a per-vertex weight,
where
{
w
R |
0
w
1
}
, the final vertex position is calculated as
n i
1
n i
v i
.
v i = v i + w i
v j
j =0
13.5.4 Results
When used in conjunction with the anatomical collisions described earlier, mesh
relaxation can give very pleasing results. Relaxation with small amounts of Lapla-
cian smoothing is sufficient for smoothing out uneven deformations. These un-
wanted artifacts can arise from discontinuities in the gradient of the skinning
weights, extreme deformations, or sometimes competing deformations (especially
in the case of multiple morph targets additively affecting a single vertex).
A solid implementation of this technique should include the ability to assign
per-vertex weights to describe what percentage of relaxation/smoothing to apply
per vertex. This is necessary to prevent the deformer from smoothing solid parts
of the mesh (e.g., buttons or fingernails).
13.6 Jiggle
The final deformation algorithm I will describe here is jiggle. This is fairly self-
explanatory: we want the mesh to react to motion and exhibit some sense of
Search Nedrilad ::




Custom Search