Correct Form To Animate Mesh Vertices Using FBX SDK Python or C++

Correct Form To Animate Mesh Vertices Using FBX SDK Python or C++

andrestronic12
Contributor Contributor
596 Views
2 Replies
Message 1 of 3

Correct Form To Animate Mesh Vertices Using FBX SDK Python or C++

andrestronic12
Contributor
Contributor

Hi.

 

People, in this moment I have a simple model with a simple animation. The model only has four bones, please see the picture.

 

Imgen1.JPG

 

I'm Working using Fbx Sdk to xtract the data and these are my steps

 

* First I get the names of the Nodes and get the Spaces Points, Indices of the model Using FbxNode Class. When I import the model is in object space Like this picture.

Imagen2.JPG

 

*When I get the data, I multiply for the world space matrix of the model this matrix is in 

 

GlobalMatrix = MeshNode.EvaluateGlobalTransform()

*Now the model looks bigger

Imagen3.JPG

 

I get the indices of each bone and weights Using FBXSkin class. after I get the datas, I get the Link Matrix of each Bone using.

 

linkMatrix = FbxAMatrix()
linkMatrix = fbxCluster.GetTransformLinkMatrix(linkMatrix)

 I get the current Matrix of each Node Using

CurrentBoneMatrix = BoneNode.EvaluateGlobalTransform(FbxTime)

Now for example I get the MAtrix of each bone in the Frame Number 20 of the animation and I multiply for each matrix.

FinalPositionMatrix =linkMatrix.Inverse() * GlobalMatrix * CurrentBoneMatrix

 

but the result is not good.

The model must be inclinated something like this.

 

Imagen5.JPG 

 

But I get this.

 

Imagen4.JPG

 

I don't Know, What's wrong please Help

 

@jiayang.xu 

 

0 Likes
597 Views
2 Replies
Replies (2)
Message 2 of 3

ilan.keshet
Enthusiast
Enthusiast

this line: 

BoneNode.EvaluateGlobalTransform(FbxTime) 

  

I've used EvaluateGlobalTransform in the past, -- at it produces strange results. -- don't use it. 

0 Likes
Message 3 of 3

ilan.keshet
Enthusiast
Enthusiast

You can verify to see if the EvaluateGlobalTransform -- is what is causing you the problem.   Print out the matrix you are getting from it -- and grab the T,R,S  from it -- and compare it to blender / maya / 3ds Max /...  value.    -- It should match what you want to see.  -- Note however, that these T,R,S given back to you are in Global space, -- so if you create a node at the root, with these transformations, it should line up to whatever node you are trying to compare to. 

-- Also this calcuation you have done: 

GlobalMatrix = MeshNode.EvaluateGlobalTransform()

Has a similar problem, and should not be used -- instead you can take the Mesh Binding transformation from the Skin Cluster

 

 

FbxAMatrix meshBindingTransform;
cluster->GetTransformMatrix(meshBindingTransform);

 

 

This will be guarenteed to work. 

 

0 Likes