Game Development Reference
In-Depth Information
13.4.4 Optimizing and Extending
The details of ray casting itself are beyond the scope of this article (see [Aman-
tides and Choi 97] for details on highly optimized ray-triangle intersection test-
ing). Suffice to say that the castRay() function should be highly optimized
since it may be called several times for each vertex. Fortunately, the collision
geometry is usually very simple and so these ray-casts are not as terribly costly as
it might sound.
It is necessary to compile a list of collision geometries to test for each vertex.
This not only avoids wasted ray-casting calculations, but it also prevents a vertex
on the finger, for example, from flying across the body should its normal intersect
a ribcage, skull, or ankle. For this reason, it is wise to assign a limit on the length
of the ray (effectively making it a directed line segment).
It is also worth mentioning that this same technique may be trivially extended
to include deformations that push the skin from the outside. Imagine the effect of
a finger being pushed into a soft belly. In this case, the collision geometry should
be specified as a pusher so that vertices that test against it use their negated vertex
normal. In this way, the vertex will push inwards if the inverse normal intersects
the collision geometry.
13.4.5 Results
This type of pseudo-collision deformation looks remarkably realistic when ap-
plied to regions of the body that exhibit a sliding effect. The jaw, biceps, clavicle,
knee, and elbow are perhaps the most obvious candidates for bone/muscle col-
lisions. It must be noted, however, that this deformation on its own can lead to
some vertex popping across frames.
To understand why, we only have to remember that we are forcibly moving
the vertex to the point of collision. This can result in snapping behavior. To
combat this issue, collision should be accompanied by some sort of smoothing
in order to avoid jarring temporal and spacial discontinuities. Relaxation is one
such smoothing algorithm that works beautifully in conjunction with anatomical
collisions.
13.5 Relaxation
Any simulation of skin behavior would be woefully inadequate if it didn't include
some sense of elasticity. Place your finger on your knuckle and push the skin
upwards. Notice the skin at the base of your wrist (a good 10 cm away), stretches