# bone matrix and fbx

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

## Recommended Posts

Hello.
I'm doing an FBX importer for skinned meshes.
I have a problem in the code section where I'm going to read the weight(posted later).
The problem is that some bones do not appear in the loop, then I can not read their local matrix inverse.
const char *boneName = cluster->GetLink()->GetName();

These bones, however, 'have an animation that I read correctly.
In the skinned animation I multiply the matrix of bone for the final matrix which is calculated by multiplying the bones fathers cyclically.
How to manage these bones which I don't know the local matrix inverse?
I can use the identity matrix???
Thank you.
static void process_clusters(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 = 0 ; i < clusterCount ; i++)	{		KFbxCluster *cluster = skin->GetCluster(i);		KFbxCluster::ELinkMode lClusterMode = cluster->GetLinkMode();		const char *boneName = cluster->GetLink()->GetName();					KFbxXMatrix kLinkMatrix;		cluster->GetTransformLinkMatrix(kLinkMatrix);		KFbxXMatrix kTM;		cluster->GetTransformMatrix(kTM);		KFbxXMatrix kInvLinkMatrix(kLinkMatrix.Inverse());		KFbxXMatrix kM(kInvLinkMatrix * kTM);				invBindPose[boneName] = kM;		bindPose[boneName] = kM.Inverse();		int indexCount = cluster->GetControlPointIndicesCount();		int *indices = cluster->GetControlPointIndices();		double *weights = cluster->GetControlPointWeights();		int bone = boneMap[boneName];		for (int j = 0 ; j < indexCount ; j++)		{			int vertex = indices[j];			float weight = (float)weights[j];			BoneWeightPair pair;							pair.bone = bone;			pair.weight = weight;			boneWeights[vertex].push_back(pair);		}	}	}

ps.
I have rename the bone names in 3ds and reexport all, may be the problem?

[Edited by - giugio on August 23, 2010 6:08:13 AM]

##### Share on other sites
Quote:
 How to manage these bones which I don't know the local matrix inverse?I can use the identity matrix???

You can't just use an identity matrix. The inverse of the bone's local matrix is what transforms the rest pose mesh vertices to the origin so animation transformations are correctly applied.

##### Share on other sites
therefore may be a problem caused by the renaming of bones?
in fact after being saved and renamed exported fbx, renamed bones lose all matrixes, even if the Conservatives for animation.
If you have a system in 3ds to recalculate the matrices of bones after i renamed they?
thanks

##### Share on other sites
I'm afraid I can't help you with the specifics of 3ds or fbx. Just wanted to let you know that you must have each bone's base matrix. [sad]

1. 1
2. 2
Rutin
22
3. 3
4. 4
frob
18
5. 5

• 33
• 13
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
632563
• Total Posts
3007099

×