Game Development Reference
In-Depth Information
So each w i
v ) for
some v . Furthermore, recall that at termination the point v is expressed as an
affine combination of W :
W is the vector difference of a i = s A ( v ) and b i = s B (
v = λ 1 w 1 + ··· + λ n w n .
Now, the closest points p A and p B are computed simply as
p A
=
λ 1 a 1 +
···
+ λ n a n ,and
p B
=
λ 1 b 1 +
···
+ λ n b n .
Since the barycentric coordinates λ i are all positive, p A and p B must be con-
tained, respectively, by A and B . It is easy to verify that v = p A
p B ,so p A
and p B are indeed closest points of A and B .
The hybrid approach serves as a faster and more robust alternative to a vanilla
penetration-depth method, but it still has the same problemwhen it comes to find-
ing contacts for triangle meshes. When sliding from one triangle to an adjacent
one, the normal direction may change dramatically depending on the skin thick-
ness and penetration depth. In order to experience smooth contacts, the mapping
of normals to the surface should be continuous.
Smoothly varying surface normals are being used in computer graphics to
solve pretty much the same problem: hiding the internal edges of a mesh
[Wikipedia 10b]. In a graphical mesh, the normals are usually given only at the
vertices. A normal at an arbitrary point in a triangle is computed by interpolat-
ing the normals at the triangle's vertices. The easiest interpolation technique that
achieves a continuous normal field on the surface is simply a normalized linear in-
terpolation. Here, the normal is computed by adding the vertex normals weighted
by the barycentric coordinates of the point in the triangle and normalizing the re-
sult. More sophisticated interpolation techniques exist as well [van Overveld and
Wyvill 97].
In solving our “bumpy edge” problem, we also apply normal interpolation.
We will use the hybrid approach to compute the closest points of the query object
and the triangles in the mesh that collide with it. However, instead of using the
difference of the closest points, we use the surface normal at the closest point
on the mesh as our contact normal. So, we need to have vertex normals for the
collision mesh and a way to compute the barycentric coordinates of the closest
point in the mesh.
We already have barycentric coordinates for the closest point at termination;
however, these are computed for the closest point of the CSO. Although the cur-
rent simplex W is affinely independent, the associated support points a i and b i
of the individual objects A and B may contain duplicates. Getting the barycentric