Jump to content
  • Advertisement
Sign in to follow this  

Bone animation with FBX

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

[color=#000000][font=Arial,]writing an fbx converter for our small game engine. I stuck with rendering the Model using the animation. The matrix for each timestamp look allright and when I render just the bones it also looks like the the orginal animation. I made some snapshot to show my problem. I just can't figure out whats wrong. In my opinion the Matrix is correct and so it must be the Bone weights / Indices. Whith PIX i controlled that the data is passed correctly. Maybe someone is able to give me a hind smile.png[/font]
[color=#000000][font=Arial,]For getting the weights and indices I use this methode:[/font]
bool BlocoFBXConverter::ParseMeshSkinning( KFbxMesh* pMesh, SkinData* pSkinData )
DWORD dwDeformerCount = pMesh->GetDeformerCount( KFbxDeformer::eSKIN );
if( dwDeformerCount == 0 )
return false;[/font]
const DWORD dwVertexCount = pMesh->GetControlPointsCount();
const DWORD dwStride = 4;
pSkinData->Alloc( dwVertexCount, dwStride );
for( DWORD dwDeformerIndex = 0; dwDeformerIndex < dwDeformerCount; ++dwDeformerIndex )
KFbxSkin* pSkin = (KFbxSkin*)pMesh->GetDeformer( dwDeformerIndex, KFbxDeformer::eSKIN );
DWORD dwClusterCount = pSkin->GetClusterCount();
for( DWORD dwClusterIndex = 0; dwClusterIndex < dwClusterCount; ++dwClusterIndex )
KFbxCluster* pCluster = pSkin->GetCluster( dwClusterIndex );
DWORD dwClusterSize = pCluster->GetControlPointIndicesCount();
if( dwClusterSize == 0 )
KFbxNode* pLink = pCluster->GetLink();
Bone bone;
bone.pNode = pLink;
bone.sName = pLink->GetName();
bone.iParentIndex = -1;
DWORD dwBoneIndex = pSkinData->GetBoneCount();
KFbxXMatrix matXBindPose;
pCluster->GetTransformLinkMatrix( matXBindPose );
KFbxMatrix matBindPose = matXBindPose;
CaptureBindPoseMatrix( pLink, matBindPose );
INT* pIndices = pCluster->GetControlPointIndices();
DOUBLE* pWeights = pCluster->GetControlPointWeights();
for( DWORD i = 0; i < dwClusterSize; ++i )
pSkinData->InsertWeight( pIndices, dwBoneIndex, (FLOAT)pWeights );
//All bones are stored. Now get the hierarchy
pSkinData->SetHierarchy( m_pScene->GetRootNode() );
return true;

[color=#000000][font=Arial,]The file I am use for testing is the humanoid.fbx from the FBX-SDK (2012)[/font]
[color=#000000][font=Arial,]The Shader should be ok:[/font]
VS_OUT output = (VS_OUT)0;[/font]
float4x4 skinTransform = 0;
skinTransform += MatrixPallette[input.BoneIndices.x] * input.Weights.x;
skinTransform += MatrixPallette[input.BoneIndices.y] * input.Weights.y;
skinTransform += MatrixPallette[input.BoneIndices.z] * input.Weights.z;
skinTransform += MatrixPallette[input.BoneIndices.w] * input.Weights.w;
//skinTransform = mul(BindShape, skinTransform);
//Transform Position
float4 worldPosition = mul(input.Position, skinTransform);
float4 viewPosition = mul(worldPosition, matView);
output.Position = mul(viewPosition, matProj);
The "skinTransform = mul(BindShape, skinTransform);" isn't needed because the matrix is allready callculated by FBX.[/font]
I addached one pic with three snapshots,[/font]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!