Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First of all, you need to know that the original vertex position of mesh is not in the world space. (For example: You will see your character stands up in the 3ds max, but it lies down if you exported the mesh data directly.)</p> <p>The same thing also happens to all transformation nodes of skeleton tree. That means, even there is only one bone with identity matrix, the mesh also need to be transformed by the root node of FBX scene, then the local matrix of bone node. ( because the root node is also the parent node of the bone node ), </p> <p>By the way, if you used the function FbxAxisSystem::ConvertScene() to convert the axis system of your mesh, that operation was only applied to the transformation matrix of root node too, not to the vertices of mesh.</p> <p>To calcualte the position of vertices correctly, you need to find the FbxNode where the mesh belonged to, then call its EvaluateGlobalTransform() function to get the global transformation matrix, and use it to transform the position of mesh vertices. (Inversed transposed matrix for normal.)</p> <p>I don't know what exactly you do in the function GetGeometry() of your code: <code>FbxAMatrix clusterGeometry = GetGeometry(cluster-&gt;GetLink());</code></p> <p>But this is my way to get the bind pose matrix of the bone: <code>FbxAMatrix BoneBindPoseMatrix; pCluster-&gt;GetTransformLinkMatrix(BoneBindPoseMatrix).</code></p> <p>To retrieve the node of bone, I also use <code>FbxNode* pBoneNode = pCluster-&gt;GetLink()</code>, and call <code>pBoneNode-&gt;EvaluateLocalTransform( CurrentTime )</code> to get the local transformation matrix of the bone at current time. But there is a special thing I did: remember that I converted the mesh by the global transformation matrix of root node right? So for the root node of skeleton, I need to get its global transformation matrix by calling <code>FbxAMatrix BoneInitPoseGlobalTransform = pBoneRootNode-&gt;EvaluateGlobalTransform()</code>, then inverse it. And the local transform matrix of my root bone will be: <code>BoneLocalTransform = InvBoneInitPoseGlobalTransform * BoneLocalTransform;</code> We only need to do it for the root node of bone.</p> <p>When animate the skin, I traverse the whole skeleton tree, for each bone node I calculate its global transformation matrix by: <code>BoneGlobalTransform = BoneLocalTransform * ParentBoneGlobalTransform;</code> But before I pass the matrix into the shader, I need to do: <code>BlendMatrix = Bone.InvBindPoseMatrix * BoneGlobalTransform;</code> Don't forget that I have already converted the postion of vertices by the root node.</p> <p>That's all, the code above works well both under D3D and OpenGL. I hope it can help you. :D</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload