Advertisement

FBX Animation import assumes Z is up, but why?

Started by November 29, 2018 01:50 PM
4 comments, last by Septopus 6 years, 2 months ago

Hi,

I wrote my animation importer for Direct3D 11 using assimp and an FBX file exported from Blender and everything is working after I flipped the axes such that Y=Z and Z=-Y. I basically multiplied


BoneOffsetMatrix = BoneOffsetMatrix * FlipMatrix

and


GlobalInverseMatrix = Inverse(FlipMatrix) * GlobalInverseMatrix

where


FlipMatrix = (	
	1,0,0,0,
	0,0,1,0,
	0,-1,0,0,
	0,0,0,1 
)

(matrices in row-major format).

But why do I have to? There are tutorials (for OpenGL, but still) where this worked fine without this step. Is it a setting in Blender that is wrong?

I am applying those transformations to my own vertices, so I'm not using the ones provided in the FBX file. But even if I did, those would be wrong without flipping the axes after the global inverse transformation.

Even though it is working, I want to give my editor to modders of my game, so I can't be sure that it works at their ends since I had to add a step that should not be required according to the documentation.

 

Cheers,

Magogan

Hello, 

The problem is different 3D modeling software vendors sometimes implement different exporting scheme from other vendors whether it's an FBX, Collada, Obj, X, etc.. and since your using Assimp let's hope it also using and following the Autodesk FBX SDK format Scheme and the engine implementation you are using which in your case it's custom made.

I also encountered this problem when loading a mesh file from different 3D software and loaders, sometimes it display correctly but most of the time it doesn't other problems I encountered are I need to flip UV X or Y to display the model correctly or need to reverse the winding vertex order and most of the 3D software doesn't generate tangent and bitangent which i needed for my shading.

You can put an option when loading your mesh/model file:

 

IN YOUR CODE :

YourContentMngr.Load(  meshFilename, etc...

        true,  // Flip Up Z to Y
        false  // Flip UV X
        true,  // Flip UV Y
        false, // Reverse winding order
        true   // Generate tangent and bitangent
     );

 

IN YOUR EDITOR

-----------------------------------
ADD MODEL
-----------------------------------
File [      .     ][...]
-----------------------------------
[Y] Flip Up | Z to Y
[X] Flip UV X
[X] Flip UV Y
[X] Reverse winding
[X] Generate tangent and bitangent
-----------------------------------
[ OK ]  [ Cancel ]
------------------------------------

When your modders tells you my model is not displaying properly, you can just say try to click  [X] Flip Up ZY  from the option when loading your model : - D


Cheers ^_^y

Advertisement

I would suggest doing exactly what @DexterZ101 suggests, especially if you're giving modders access.  You could also write/find specific instructions for each 3d modeling software on how to export the model correctly to work with your game...  And you may want to do that as well.

Blender specifically has an export options section(bottom left of screen during export) that allows you to change the orientation of the exported model.  This would probably solve the issue with Blender models...  But each modeling software is going to have its own quirks. ;)

Exactly Bro! he cannot assume that the user knows how to use Blender or the FBX file the modders going to use is made only from Blender it can be made from Maya or Studio max, it would be nice if the application/engine have an option to this scenario rather than fixed it hard coded.

If it were my game, I would also add in a peer/authoritative review process, so somebody with a mind for the games integrity has to "OK" any modder imported models before they go live...  Unless it's not online/multi-player, then I suppose they would only be messing up their copy..

Edit:  Though now that I think about it, they would probably only be messing up their side anyhow.. ;)  So nvm..

 

This topic is closed to new replies.

Advertisement