chinedufn / blender-actions-to-json

Write the joint data for all of a `.blend` file's actions to a JSON file
17 stars 8 forks source link

What are `inverseBindPoses` ? #1

Closed kevzettler closed 7 years ago

kevzettler commented 7 years ago

I having a hard time finding out what the inverseBindPoses data is. Seems it might be Collada specific?

chinedufn commented 7 years ago

inverseBindPoses are the inverse bind matrices for each joint. Actually turns out this they are a general part of skinning and have nothing to do with COLLADA.

The pose matrices in the .actions object that we export are all in model space, If you applied them to your vertices you would see crazy results. This is because, for example, if your head bone starts off at [0, 3, 0] and you assigned your head vertices to it... they now move up by 3 units on the y axis (since your head bone is technically specifying a transformation of +3 on the y axis). But you don't want your vertices to move until your head starts moving away from this initial bind position of [0, 3, 0]

So by multiplying by the inverse bind matrix you essentially are converting your rigs bind poses into an identify matrices. So your head bone is now starting off in bone space at [0, 0, 0]. So when you transform your vertices with this [0, 0, 0], they don't move. If your head bone is moved to [0, 4, 0] in model space, the inverse bind matrix would negate the bind position of [0, 3, 0] and bring it to [0, 1, 0] in bone space. So your vertices end moving up by one unit on the y axis, as expected.

The inverse bind matrix ensures that when you parent your mesh to your rig your vertices won't move (because all of your bones get turned into identity matrices before transforming your vertices) until you move your rig out of this bind position

Sorry if any of that is sloppy, on mobile!