weighted vertices

Hello. I’m want to put a mesh over a skeleton, and the position of all the vertices in the mesh will depend on it’s closeness to certain bones.
For example, a vertex in the middle of the fore-arm will be slightly affected by the position of the upper-arm, but mostly affected by the position of the fore-arm. This is accomplished by calculating at load time, weights for all bones around a given vertex. Then these weights must be applied during run time of the animated character.
Will this be efficient, say for 1-2 8000 poly characters? If not, is there a better way?
Thanks. Hope you understand what I’m trying to do…

I think what you want to do… and is what many people do (including those at both game companies I have worked for in the past) it store for each joint, an offset from the parent joint and a rotation value, then all vertices of that peice are relative to that joint. There might be better ways, but this is the way I know

Anways, just to dig a little bit deeper…
To draw the object, simple step through it’s heirarchy like such: (in almost-code… a bit more advanced than psuedo-code)

class Mesh{
Mesh *child;
Mesh *next; // sibling
Face *faces;
Vector3 offset;
EulerAngle orientation; //or whatever

  void Draw();


void Mesh: raw()
// save matrix stack
// add this joint’s translation and orientation
glTranslatef( offset.x, offset.y, offset.z );
glRotate( orientation ); //–however I use quaternions actually

// draw all the faces of this peice
faces->DrawFaces(); // again however…

// if a child exists, draw it
if( child )

// restore stack

// if a sibling exists, draw it
if( next )

Now, to animate, simply go through the list updating the orientation of each joint that moves each time it moves.

If you need furthur explaination, please feel free to email me: kyberteknik@geocities.com

I don’t think this is getting the effect I was talking about. This will animate the mesh in chunks based on the position of the skeleton, which is basically what I wanted to do. However, my main problem was coming up with a good way to fill in the spaces that may appear at joints. I was using two or three bones to affect the position of one vertex. I’m thinking that if the fore-arm rotates, an ugly crack will appear at the elbow, and at the inner elbow, textures will slide under one-another. Am I right in my thinking? I don’t have much experience in this stuff, so I’m just trying to picture it in my head…

Have you seen GL_EXT_vertex_weighting ?

It’s designed to solve exactly this problem, and is supported by current high-end consumer hardware. There’s a description in nVIDIA’s extensions doc, at http://www.nvidia.com/Marketing/Developer/DevRel.nsf/pages/A86B9D846E815D628825681E007AA680

I didn’t think that openGL would implement something like that…

The problem with this extension is that it doesn’t appear on all drivers.

I have a graphics blaster 3d TNT2 and my driver doesn’t support it. How do I acheive the same results, with and without the extension?


You should check the DirectX Bend sample (a bending banana ) from the DirectX SDK (immediate mode samples). It does vertex blending using 2 matrices.

Also, there is a document in the MSDN library that gives all the formulas you need. Just do a topic search on “blending weights” and you will find it.

Good luck !

Thanks. I started looking at the banana example. Just one thing. I searched for “blending weights” in “MSDN Library
Visual Studio 6.0 release”, with no luck. Is this the right place? Thanks for the help.

Actually, you can get the same thing on Microsoft’s web site. Go to this address :

Thanks for the help.

Glad I could help !