Vertex weighting and/or manipulating skeletal models

I’m curious, what is vertex weighting used for? I was thinking it may be used for manipulating skeletons of models by rotating bones around joints, but I wasn’t sure.

Does anyone know of any good tutorials on either vertex weighting or manipulation of skeletal models, I’m having a rough time finding any info on either.

Thanks alot, any info is much appreciated, as I’m trying to learn all that my card (GeForce 2 MX) is capable of.

Vertex weighting is pretty much useless on a GF2 (or classic Radeon). You really need to be able to pull bone assignments and weights from some sort of palette; typically by writing a vertex shader. If the hardware can’t do that, it’s faster to do it all in software.

As for references: I have no idea. It all seemed fairly straightforward to me when I first found out about it; I coded it up and it worked. Basically, you have one local transform matrix per bone. Each vert can then reference some number of bones with a weight per reference. To calculate the “actual” vert position, you transform the vert separately by each affecting bones’ matrix, and then blend (interpolate) the separate results based on the weights.

The simple two-weights-per-bone case looks something like this:

struct Vert {
Pos p;
int bone0; float weight0;
int bone1; float weight1;
};

void SkinVerts( Matrix const * bones, Vert const * inVerts, Pos * outVerts, int count )
{
for( int ix = 0; ix < count; ++ix ) {
Pos p0 = bones[ inVerts[ ix ].bone0 ] * inVerts[ ix ].p;
Pos p1 = bones[ inVerts[ ix ].bone1 ] * inVerts[ ix ].p;
outVerts[ ix ] = p0 * inVerts[ ix ].weight0 + p1 * inVerts[ ix ].weight1;
}
}

In the typical case, weight0 + weight1 will always be 1.0, and thus weight1 can be omitted and re-derived from weight0. Also, in very modern games, you’ll see more than two bones influencing each vertex.

Here comes the problem with the “vertex weighting” extension: because there can only be two bones TOTAL in all the triangles you draw in a single call, you have to slice your model into a hundred little itsy bitsy pieces, depending on which bones they’re weigthed to.

Even worse: because all verts in the same triangle needs to be weighted to the same two bones (only), the “seam” verts between different bone influences need to only be weighted to a single bone, so they can be used in both segments. This looks very bad.

Thank you jwatte, your post enlightened me. If I understood correctly, I can now see all the fuss about vertex shaders! I’m kinda getting bogged down trying to keep up with the “latest” technology and how to implement it, so please forgive my ignorance

So, back to skeletal manipulations…
I know I have a matrix per bone that specifies its orientation and position (relative to another bone). Now joints connect two bones together, so when specifying the matrix per bone–are the weights the joints? Is that the logic behind it? Or should I specify a matrix for the joint, and have the weights adjust the bones connected to it?

Matrix----Weight*-----Matrix
bone joint bone

OR:

Weight----Matrix*-----Weight
bone joint bone

Using the logic that all bones rotate around joints. And as more joints and bones are connected to eachother, the rotations become increasingly relative to its parent’s orientation and location.

The reason I ask is because I want to know the “correct” way doing this so I can avoid headaches down the road. Thanks again!

Oh, and I hope I make sense!