Game Development Reference

In-Depth Information

get transformed according to their assigned bone. The position of a vertex is a

weighted sum of these transformed weight positions. The Internet provides a lot

of detailed documentation on this format.

Geometry produced from this specification works well as a kinematic basis

for the secondary deformations presented here.

The vertices in the MD5 format are given implicitly as a sum of weights:

struct
ModelVertex
{
int
start;
int
count;
}
;

Here,
start
defines the first weight and
count
the number of weights after the

starting weights that belong to this vertex:

struct
ModelWeight

{

int
joint;
float
bias; Vector3 pos;

}

;

The weight contains the information of how to construct the final vertex po-

sitions;
pos
defines the position of the weight, and
bias
states how much the

weight contributes to the vertex. Using the weight, we can access the bone model

information, since
joint
assigns each weight a joint:

struct
ModelJoint

{

char
name[64];

int
parent;

Vector3 pos;

Quat4 orient;

}
;

This is basically the same definition of a joint that was used before. List-

ings 14.2 and 14.3 show the application of the surface-detail preservation and the

bone-distance preservation forces to an actual MD5 model. Since an MD5 model

can consist of several independent meshes, we have to specify which one we want

to deform. The supplementary material includes an application that demonstrates

the interactive deformation of the animated Stanford armadillo model (see
Fig-