Skeleton animation bone calculation

Started by
2 comments, last by Buckshag 16 years, 1 month ago
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?
Advertisement
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]
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 :)

This topic is closed to new replies.

Advertisement