Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® FBX® / FBX SDK / Question about skinning (could you please help me, Jiayang?)
  RSS 2.0 ATOM  

Question about skinning (could you please help me, Jiayang?)
Rate this thread
 
49676
 
Permlink of this thread  
avatar
  • Shuang
  • Posted: 20 November 2010 08:26 PM
  • Total Posts: 4
  • Joined: 21 November 2010 03:17 AM

Hi, Jiayang,

I’m now working on skeleton animation for my engine and trying to import data from fbx file. I have checked ViewScene example and write code to do almost the same thing as the example code. My code works well for one of my test files. However, it failed with the other one.

Here is what I do:
1) extract vertex data from KFbxMesh, multiplied by node->GetGeometricT/R/S()
2) extract bone animation from KFbxAnimCurveNode. Currently I only use the curves for LclRotation and LclTranslation. The rotation order I use is Z->Y->X (seems to be the order used by 3DSMAX...i’m not sure of that)
3) extract inverse binding matrix as: ClusterTransformLink.Inverse * ClusterTransform

Anything wrong? I have read one of your posts saying that the ClusterTransformLink is already the binding matrix. So I tried to remove ClusterTransform and it just get worse: both of my test files failed. So what is the exactly meaning of ClusterTransformLink and ClusterTransform? The official doc is quite unclear on this part. Could you give me some more info?



Replies: 0
avatar
  • Shuang
  • Posted: 22 November 2010 01:48 PM

After some experiments, I still can’t solve this problem. But I found some clues on the issue.

My test fbx file contains more than one meshes binding to one single shared skeleton. When I extract data from such a file, some meshes work well while the others don’t. Then I tried to keep only one mesh in the fbx file and delete all the other ones (of course, the kept one was the one with problem), it works correctly. I compared the extracted data between the good one and the bad one. Only the inverse binding matrices seem different:

The good one:
-5.492836, 0.592427, -32.472796, 0.000000,
5.532836, -36.100664, -1.594504, 0.000000,
-38.531812, -6.188327, 6.404832, 0.000000,
0.459099, -0.032397, -0.231797, 1.000000

The bad one:
5.492836, -0.592427, 32.472796, 0.000000,
5.532836, -36.100664, -1.594504, 0.000000,
-38.531812, -6.188327, 6.404832, 0.000000,
0.459099, -0.032397, -0.231797, 1.000000

As we can see: it’s just some polarity difference.

What could be the root cause of this? I just removed some meshes from the fbx file without changing anything of the skeleton. Then the matrices of clusters were changed. Can anyone give me some hints on this?



Replies: 0
avatar
  • Shuang
  • Posted: 22 November 2010 02:15 PM

Ok, now I found why the inverse bining matrix was changed. The two meshes share the same bone node but they use different set of clusters. I made a mistake in my code:

node->GetDstObject<KFbxCluster>(0)

I’m always getting the first cluster. That is not necessarily the right one when there are more than one meshes in the scene.

Things are now getting more complicated. I need to share the same skeleton data among multiple meshes. But now it seems impossible with fbx because it creates different cluster data for different skin binding, even when they are actually binded to the same skeleton.

How can I fix this?…



Replies: 0
avatar

Dear Shuang, it is ok for two geometries to use one joint hierarchy.
They will be organized by the KFbxSkin deformer properly, please try this, for each mesh:

KFbxSkinlSkinDeformer reinterpret_cast<KFbxSkin*>(lGeometry->GetDeformer(0KFbxDeformer::eSKIN));

 if(
lSkinDeformer)
 
{
     
const int lTotalClusterCount lSkinDeformer->GetClusterCount();

     for (
lCount 0lCount lTotalClusterCountlCount++)
     
{
         KFbxCluster
lFbxCluster lSkinDeformer->GetCluster(lCount);
         
//Do the binding
     
}
 }

FBX creates different cluster data for different skin binding because even if you are using the same joint hierarchy, the bones may still be in different positions at the binding moments for different geometries.
In your case, if you are sure all binding are exactly the same for different geometries, you may apply a same KFbxSkin deformer to all of them, then they can share the same skeleton data.

It would also be helpful if you can provide the FBX file you are using, attach it as a zip file, if it can not be public, you may send it to fbxsdk at autodesk dot com, thanks.

BTW: Cluster TransformLink is the global matrix of the bone(link) at the binding moment.
Cluster Transform is the global matrix of the geometry at the binding moment.



Jiayang Xu
Maya Data Platform
Autodesk

Replies: 1
/img/forum/dark/default_avatar.png

Many thanks, Jiayang. Now I understand what ClusterTransformLink and ClusterTransform are. Finally I solved the issue by premultiply my mesh with ClusterTransform. Now everything just work perfectly well. Yes, you are right. The ClusterTransformLink can be shared among several geometries.

Thanks a lot!

Author: Shuang

Replied: 23 November 2010 01:29 PM