Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® FBX® / FBX SDK / [Resolved] Axis up : always Y ?
  RSS 2.0 ATOM  

[Resolved] Axis up : always Y ?
Rate this thread
 
43683
 
Permlink of this thread  
avatar
  • luinil
  • Posted: 27 May 2010 03:01 PM
  • Location: Tokyo
  • Total Posts: 23
  • Joined: 21 April 2010 01:09 AM

Hello,

I’m trying to import a FBX file exported by 3ds Max and have a problem about the up axis.

I want to be able to import the file independently of the choice of the up axis at the export in max.

I already resolved the problem of the pre-rotation that I have when choosing Y as up axis and then have the file correctly displayed but, I sill have a problem with the file which has Z as up axis : the whole file content has a rotation of +-90°on the X axis.

In my code I do that after the import

lImporter->Import(DllScene)
 
 int sign
;
 if 
(DllScene->GetGlobalSettings().GetAxisSystem().GetUpVector(sign) == KFbxAxisSystem::YAxis)
 MessageBoxA(NULL
,"Y up","File found",MB_OK)
 
else
 
MessageBoxA(NULL,"Z up","File found",MB_OK)

 
//convertion for the non opengl axis systems
 
KFbxAxisSystem sys (KFbxAxisSystem::YAxisKFbxAxisSystem::ParityOdd KFbxAxisSystem::RightHanded)
 sys
.ConvertScene(DllScene)

One of the problem is, while in the fbx file I can see that the up axis is correct, using that code I always have the result Y axis up, independently of the setting in max (Y or Z up).
If the SDK always sees Y as up, I guess it’s normal it doesn’t correct the orientation when Z is up and that my model is displayed with the 90°rotation.

Does someone has any Idea of how I could correct that ?

Thanks for your help.



Replies: 1
/userdata/avatar/vx3501hqr_small.jpg

Hi, luinil,
Maybe I did not get your real question. So if my answer if not what you really asked, please let me know and clarify your questions, thanks. :)

In your code, you called sys.ConvertScene(DllScene) to convert all non OpenGL axis systems to OpenGL system, which is Y-up.
So if the file is Z-up originally, then to convert Z-up to Y-up, it is normal that there is a -90 degree rotation on X axis, that is the whole meaning of the conversion from Z-up to Y-up.

Author: Jiayang Xu

Replied: 27 May 2010 08:01 PM  
avatar

I think it depends on what your exporting to, I for example im always exporting to UNITY game engine, in my FBX settings Ive always got Y as the up axis, to my knowledge all this does it take my Z axis from max and makes it relative to Y is up when importing into Unity. Everything I import in works fine. I also don’t use the 2011 FBX exporter, seems to have a few issues, i just stick to 2009, works fine for me, and if exporting animation rigs works wonders with that also.

3D Ninja



sknnedesign
‘If it Bleeds, we can kill it’ - Dutch from ‘Predator’-1987

Replies: 0
avatar

Hi luinil,

I am not sure either what you are asking.

Your code, translated in pseudo-code, does this:

-print if file is Y-up or Z-up
-convert to Y-up.

Then you say:

using that code I always have the result Y axis up

.

Well… of course, since the code is converting to Y-up.

Or maybe you mean that the first step always prints that the file is Y-up. Then I must ask you how you determine the setting in 3ds Max? When in 3ds Max, when exporting to FBX, do you select
Advanced Options - Axis Conversion - Up Axis: Z-up ?

Viviane



Viviane Rochon
Maya Data Platform
Autodesk

Replies: 0
avatar
  • luinil
  • Posted: 30 May 2010 01:08 PM

First thanks for the answer.

Yes I know I do the conversion to Y up, but in my code you can see that I do the test to see which of Y or Z is up BEFORE the conversion, and in that case I always obtain Y up as a result, independently of the choice of Z up or Y up in the FBX export settings in MAX.

I use, as you say “Advanced Options - Axis Conversion - Up Axis: Z-up” when exporting from MAX.
If I look into the FBX file, the Up axis is correctly indicated (2 for z, 1 for y), but in the code I wrote in my first message, the test always returns Y up.

My question would be, how do I discriminate a Z up scene and a Y up scene so I can apply the right transformations on it ? For now both are indicated as Y up.

Again, thanks for you help.



Replies: 1
/userdata/avatar/vx3501hqr_small.jpg

hi, luinil,
I can not reproduce the problem, with following code I can get correct up vector:
KFbxAxisSystem lSceneAxisSystem = lScene->GetGlobalSettings().GetAxisSystem()
int lSign;
KFbxAxisSystem::eUpVector lUpVectorFromFile = lSceneAxisSystem.GetUpVector(lSign)

Since you said you looked in the FBX file exported from max, and the Up axis is correct there, so this can only be a problem of detecting the Up axis by SDK, could you tell us which version of FBXSDK you are using? And it would be better if you can provide the FBX files that have different up axis but failed to be detected later. Make sure you upload them as an .zip, thank you.

Author: Jiayang Xu

Replied: 30 May 2010 05:44 PM  
avatar
  • luinil
  • Posted: 30 May 2010 06:20 PM

I’m using the 2010.2 version of the FBX Sdk.

You have in attachment a Zip file with the same max model exported with Z up and with Y up, both of them showing up as Y up with the code I posted in the first message.



Attachment Attachment
Replies: 1
/userdata/avatar/vx3501hqr_small.jpg

Yes, now I can reproduce the problem. And I think the reason is this:
The version of the FBX files you attached are FBX 7.1.0, however, the complete support to this version only start from 2011.2, officially 2010.2 only provide support to FBX 6.1.0 and the earlier versions.
Although you can use 2010.2 to read FBX 7.1.0 files, there might be problems.

So to handle FBX 7.1.0, the best way is to upgrade to 2011.2.

Author: Jiayang Xu

Replied: 30 May 2010 09:06 PM  
avatar
  • luinil
  • Posted: 30 May 2010 09:31 PM

Tried with 2011.2 and actually got Z up as expected.

Thanks for your help, I’ll look how to upgrade my code to 2011.



Replies: 0