[QUOTE=Darkpower;1271410]How do I determine the maximum number of bones that influence a vertex in a mesh? In this tutorial, they did choose 4, how come? If you look furher down in this tutorial, this line can be found:

```
struct VertexBoneData
{
uint IDs[NUM_BONES_PER_VEREX];
float Weights[NUM_BONES_PER_VEREX];
}
```

[/quote]

Why 4? It’s a balance between minimizing space and what’s generally useful in practice. You need more than 1 for blending influences from multiple joints, 2 usually isn’t enough, and 4 is often sufficient.

Also, you’ll need to encode all of the joint indices and weights influencing a vertex on each vertex in your skeletal mesh, so you need to keep the number down. And GPU vertex attributes work well with multiples of 4. Each vertex attribute is basically 4*32-bits wide. So you could (as above) use 4 full 32-bit units for the joint indices and 4 full 32-bit floats for the joint weights, consuming an even 2 full 128-bit vertex attributes (total = 2*(4*32) = 256-bits).

However, then you might ask yourself: do I really need the possibility of 65535 joints in a joint skeleton, and a full 32-bit float to represent a 0…1 weight? No, probably not. So what about if we limit outselves to 255 joints in a joint skeleton? Then we could use 4 8-bit uints for the joint indices (supporting up to 255 joints) and 4 8-bit uints for the joint weights. Bit-pack this and you find find you can pass all this into the shader with 1/4 of the space: only 64-bits, which is just two components on a single vertex attribute (e.g. attr.x and attr.y).

I have downloaded an animated mesh(FBX format) with bones. Look at the screenshots(without the skin/mesh, using Cinema 4D): http://oi62.tinypic.com/xkybu9.jpg and http://oi61.tinypic.com/b65w02.jpg

Is this correct? Seven bones influence the middle vertex?

No. Typically this “stick diagram” you’re looking at is used to represent parent/child relationships between joints in the joint skeleton (the big end is typically the parent joint). There’s nothing in this picture about the mesh. This is purely joint skeleton stuff.

In terms of modeling, the joint skeleton is defined first. The joint skeleton is basically defined as the list of joints, the parent/child relationships between joints, and the positions/orientations of child joint’s relative to its parent in the “bind pose”. Once that’s defined, the mesh is “skinned” to the joint skeleton – basically by defining joint influences and joint weights for each vertex in the mesh, “attaching” it to the skeleton. Once that’s done, the mesh can be animated by animating the joint skeleton alone.