# "Backwards" skinning

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

## Recommended Posts

I'm trying to get skinning working, and I'm having some trouble with vertices affected by more than 1 bone. The error might be in my skinning or my exporter and I assume it is the latter because the techniques for skinning is rather straight-forward. Here's what I'm doing... t = transformed vertex u = untransformed vertex b = bone matrix w = bone weight When skinning: t = u*b0*w0 + u*b1*w1 + ... And when I'm exporting, I want to export the untransformed (u) coordinates, but I currently have the transformed (t), so here's what I'm doing: u = t*inv(b0)*(1/w0) + t*inv(b1)*(1/w1) ... Like I said, this works fine when I only have one bone, but with more than 1 bone, this fails. My linear algebra is not the best, so please help me out!

##### Share on other sites
Skinning with weighted vertexes is more complicated because you no longer associate a vertex with a single bone.

When you export the model, you export it in a "reference" pose. The exported vertexes should be in model space.

To transform a weighted vertex by a bone ... first transform it into the reference pose bone space to get its unanimated position in the bone's space. Then animate it by transforming it by the animation's bone transformation. Then weight it.

In short,

i = bone id
Ri = reference pose bone transformation
Bi = animation's bone transformation
wi = weight
t = SUM( u*Ri-1*Bi*wi )

Note that Ri-1*Bi is the same for all vertexes. So, if Qi = Ri-1*Bi, then

t = SUM( u*Qi*wi )

##### Share on other sites
Skinning tutorials

John describes this very nicely. In the tutorials I review how to transform the vertex by multiple influences,etc. I doubt if the mistake is in your exporter- but of course i don't have your source. sounds like you got a single bone going so that leads me to think the mistake was made during the vertex transformation. checkout the bone::Transform() code in the software skin tutorial. if using shaders checkout my matrix palette skin article.

• 21
• 15
• 9
• 17
• 13