# OpenGL Skeleton animation bone calculation

This topic is 3796 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I was writing a skeleton animation system in opengl, and I was wondering what is the correct way of calculating a bone's weight on a vertex. I mean if a vertex falls under 2 bones, the bone closer should have a greater weight on the vertex, but how would I write a function that calculate the weight of n bones?

##### Share on other sites
You could sum all their weights together.
Based on for example the distance like you say.

Then at the end normalize the weights. Dividing the weight values by the total weight, so that the sum of all weights equals 1.

What is often done in art packages is painting weights. Where artists paint with a brush on the mesh, defining how much a given vertex is influenced by a given bone. Where white means full influence, and black means no influence at all.

Other techniques use enveloppes, which are like ellipsoids shapes. Basically based on distance, and some 'attenuation' like properties.

Not sure if that answered your question though. I don't think there is any 'correct' way of generating weights. I doubt there is any algorithm that works without manual tweaking in 100% of all cases. This is why weight painting is very useful too.

[Edited by - Buckshag on February 28, 2008 10:19:23 AM]

##### Share on other sites
Do you mean something like this?

float d1; //Distance of Vertex to Bone1
float d2; //Distance of Vertex to Bone2
d1 = 1/d1;
d2 = 1/d2;
total = d1 + d2;
weight1 = d1 / total;
weight2 = d2 / total;

[Edited by - FireViper on February 28, 2008 5:43:41 PM]

Yes, indeed :)

1. 1
2. 2
Rutin
24
3. 3
4. 4
JoeJ
16
5. 5

• 14
• 29
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631773
• Total Posts
3002271
×