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 / KFbxCluster link, Please help me am very lost...
  RSS 2.0 ATOM  

KFbxCluster link, Please help me am very lost...
Rate this thread
 
60206
 
Permlink of this thread  
avatar
  • JCAA
  • Posted: 21 September 2011 04:18 AM
  • Total Posts: 20
  • Joined: 01 April 2010 05:06 PM

i am iterating the clusters in the mesh, i used a code from this forums.

void ProcessClusters(KFbxMesh *mesh)
{
 
if (!mesh->GetDeformerCount()) 
 return; 
 
 
KFbxDeformer *def mesh->GetDeformer(0); 
 
KFbxDeformer::EDeformerType defType def->GetDeformerType(); 
 
assert(defType == KFbxDeformer::eSKIN); 
 
 
KFbxSkin *skin KFbxCast<KFbxSkin>(def); 
 
int clusterCount skin->GetClusterCount(); 
 
 for (
int i clusterCount i++) 
 

 KFbxCluster 
*cluster skin->GetCluster(i); 
 
KFbxCluster::ELinkMode lClusterMode cluster->GetLinkMode(); 
 const 
char *boneName cluster->GetLink()->GetName();
 
 
bones[i].id i;
 
bones[i].parent_id GetBoneIndex(cluster->GetLink()->GetParent()->GetName());
 
bones[i].name std::string(boneName);
 
 
KFbxXMatrix kLinkMatrix
 
cluster->GetTransformLinkMatrix(kLinkMatrix);
 
 
KFbxXMatrix kTM
 
cluster->GetTransformMatrix(kTM); 
 
KFbxXMatrix kInvLinkMatrix(kLinkMatrix.Inverse()); 
 
KFbxXMatrix kM(kInvLinkMatrix kTM);
 
 
int indexCount cluster->GetControlPointIndicesCount(); 
 
int *indices cluster->GetControlPointIndices(); 
 
double *weights cluster->GetControlPointWeights(); 
 
 for (
int j indexCount j++) 
 

 int vertex 
indices[j]
 
float weight = (float)weights[j]
 
 
BoneAssignments ba;
 
ba.ctrlPtsIndice vertex;
 
ba.weight weight;
 
ba.bone bones[i];

 
boneAssignments.push_backba );
 

 }
}

As show in the code to obtain the transformation matrix

KFbxXMatrix kTM
 
cluster->GetTransformMatrix(kTM); 
 
KFbxXMatrix kInvLinkMatrix(kLinkMatrix.Inverse()); 
 
KFbxXMatrix kM(kInvLinkMatrix kTM);

I like know
- This Matrix comes from the position of the skeleton in a certain animation time or comes from the original “skin pose” in where the skeleton was created?.
- If the answer to the previous question is no, how can i obtain the original skin pose for each KFbxCluster ?
- When i advance an animation how can i obtain the position in the current time for each KFbxCluster ?

Sorry for the long question but i was coding and coding with no results and i prefer question all this to not lose more time.



Replies: 1
/userdata/avatar/vx3501hqr_small.jpg

From cluster->GetTransformMatrix you get the original pose of the geometry that is binded.
From cluster->GetTransformLinkMatrix you get the original pose of the skeleton.
Here are the documents of these two matrices:
* \li Transform refers to the global initial transform of the geometry node that contains the link node.
* \li TransformLink refers to global initial transform of the link node.

The code you posted are just get the information out of cluster and put them into the BoneAssignments, it did nothing about the animation.
To see how the cluster info can drive animated bones please take a look at the FBX SDK sample ViewScene, the ComputeClusterDeformation() function in DrawScene.cxx.

Take a look at the following post should also be helpful:
http://area.autodesk.com/for...he-vertices-of-a-cluster/

Author: Jiayang Xu

Replied: 22 September 2011 09:22 PM