Community
FBX Forum
Welcome to Autodesk’s FBX Forums. Share your knowledge, ask questions, and explore popular FBX topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FBX Importer for DirectX

0 REPLIES 0
Reply
Message 1 of 1
Anonymous
752 Views, 0 Replies

FBX Importer for DirectX

I'm trying to import an fbx file into my managed DirectX application. The problem I'm having is importing a skinned mesh.

 

The transformation of my mesh during animation is incorrect. The mesh appears to rotate around the wrong axis. The mesh in question is a simple mesh containing 3 cubes. Each of these cubes should rotate around the 'Up' axis. Instead they are rotating around the 'Look' axis. Here is screenshot:

 

BackBuffer.jpg

 

I am converting the fbx transform data like so:

 

// skin info
                    SkinInfo si = new SkinInfo(ncVertices, vertexElements.ToArray(), ncBones);

                    // inst. bone offsets array
                    Matrix[] boneOffsets = new Matrix[ncBones];

                    // inst. bone matrices lookup array
                    GDEFrame[] boneMatricesLookup = new GDEFrame[ncBones];

                    foreach(FBXDeformer child in model.Deformer.Children)
                    {
                        // set bone name
                        si.SetBoneName(nc, child.Frame.Name);

                        // compute inverse bind pose transform( inverse transform link * bone transform * geometry transform )
                        Matrix m = Matrix.Transpose(Matrix.Invert(child.TransformLink) * child.Transform) * model.Frame.TransformationMatrix;

                        // set offset matrix( used to transform vertices 
                        si.SetBoneOffsetMatrix(nc, boneOffsets[nc] = m);

                        // set bone influences
                        si.SetBoneInfluence(nc, child.Indices.ToArray(), child.Weights.ToArray());

                        // set bone matrices lookup frame
                        boneMatricesLookup[nc] = child.Frame;

                        // inc. counter
                        nc++;
                    }

                    // set skin info
                    smc.SetSkinInfo(si)
                        .SetMaxVertexInfluences(si.MaximumVertexInfluences)
                        .SetBoneOffsets(boneOffsets)
                        .SetMatrixPalette(boneMatricesLookup);

How do I correctly convert the fbx transforms?

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report