Jump to content
  • Advertisement
Sign in to follow this  
Stainless

Problems with exporting FBX files

This topic is 988 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

I am trying to add FBX export to one of my tools to keep the TA's happy.

 

The file I am trying to export is a structure of meshes that form an aircraft. So wings are children of the main body, ailerons children of the wing and so on.

 

I can export them all and keep the structure intact, however I cannot get the transformation matrices correct.

 

Looking at the FBX file structure I can see four sets of transformation data lcl  (local),  pre (I guess pre -animation) , post (I guess post animation), and geometric (no clue).

 

I started out using the lcl transformation set and had some success. The mesh parts appeared in the correct location but totally in the wrong orientation. Since then I have tried all the options with no success.

 

Using pre,post,and geometric ends up with all my mesh parts at 0,0,0 and all in the incorrect orientation.

 

Using lcl I get translation, but no rotation. 

 

I have tried everything I can think of and I am getting nowhere.  

 

I have tried....

 

Rotations in degrees

Making all mesh parts a child of the root node

Setting all four sets to the same values

Editing the FBX file by hand

Setting all flags and limits by hand.

......

 

 

Just nothing.

 

To test the FBX files I am using Autodesk's own viewer, so it's not an issue with my rendering code.

 

Please someone put me out of my misery, or at least give me some sort of clue to figure out what is going on.

 

 

 

Share this post


Link to post
Share on other sites
Advertisement

No that's no use.

 

I am exporting a mesh as FBX and viewing it in third party apps.  The values I am exporting exist in the fbx file, but are not applied to the mesh parts when in the viewer.

 

So when loaded into 3ds max, the mesh parts are all rotated incorrectly.

 

When displaying with autodesk's own fbx viewer they are rotated incorrectly.

 

Changing the rotation values  in the FBX file has no effect on the results in either tool.

Edited by Stainless

Share this post


Link to post
Share on other sites

Are you using the same coordinate system as FBX?

What works for me is just storing the local transformations, but I have to convert into the right handed coordinate system where negative z points into the depth, y points up and x to the right.

 

fbxNode->LclTranslation.Set( FbxVector4(pos.x, pos.y, -pos.z) );
fbxNode->LclRotation.Set( FbxVector4( Math::RadiansToDegrees(-rot.x), Math::RadiansToDegrees(-rot.y), Math::RadiansToDegrees(rot.z)));
fbxNode->LclScaling.Set( FbxVector4(scale.x, scale.y, scale.z) );

Also make sure to use degrees instead of radians in this function.

 

I was able to export full characters including bone hierarchies etc for some clients using this code, and they appeared correct in Max after importing the FBX, so I assume this must work for you as well, unless something else is going on.

Share this post


Link to post
Share on other sites

Degrees.........  Degrees ......  angles in degrees.... what is this ? The stone age.

 

Sigh.

 

That helps a lot, thanks.  I still have issues though. I got bitten by the coordinate system as well, but that's easy to fix.

 

It now looks like local translations are not absolute but relative. So the parent nodes matrix is applied first. Will confirm that later today and report back.

 

Could be a bug in my code though, we'll see.

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!