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: 

-90 PostRotation of camera and light nodes

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
890 Views, 2 Replies

-90 PostRotation of camera and light nodes

Greetings,

We recently ran into some behavior that we don't quite understand whenever lights or cameras are exported.

In a simple Max scene consisting of a free camera, target direct light, and a mesh, the camera and light have an additional post rotation applied. For the camera, the postrotation is (0,-90,0). For the light, it is (-90,0,0). This also being exported with Z-up.

The closest answer that I could find was here:

http://area.autodesk.com/forum/autodesk-fbx/fbx-sdk/max-cameras-and-postrotation/

But I'm still not entirely clear why the rotation needs to be applied. That link doesn't also really explain why lights need it, too.

If anyone could elaborate on this or point me towards any additional resources, I'd appreciate it. I didn't really find anything talking about this specifically in the SDK docs (though I could've missed it).

Thanks
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

Investigating further, it seems as though that I'm getting bogus rotations for cameras and lights.

Taking a target direct light as an example. In Max 2010, I have it located at (-0.696, 104.816, 0.0) in the world with euler rotations of (-90, -180, 0.155). In maxscript, I dumped out the transform:


$Direct01.transform
(matrix3 )


So far, this seems correct. When I export to FBX (2012) with z-up, the FBX file has this entry:


Model: 791804896, "Model::Direct01", "Light" {
Version: 232
Properties70: {
P: "PostRotation", "Vector3D", "Vector", "",-90,-0,0
P: "RotationActive", "bool", "", "",1
P: "InheritType", "enum", "", "",1
P: "ScalingMax", "Vector3D", "Vector", "",0,0,0
P: "DefaultAttributeIndex", "int", "Integer", "",0
P: "Lcl Translation", "Lcl Translation", "", "A",-0.696053683757782,104.815559387207,2.02489763978519e-006
P: "Lcl Rotation", "Lcl Rotation", "", "A",89.9999993235163,-0,-179.844973597
P: "Lcl Scaling", "Lcl Scaling", "", "A",1.00000002457802,1,1.00000002457802
P: "MaxHandle", "int", "Integer", "UH",2
}
MultiLayer: 0
MultiTake: 0
Shading: T
Culling: "CullingOff"


The first thing that I noticed is that the local rotation and post rotation are not what I expected. Even when I manually calculate LclRotation*PostRotation, I get


- 0.9999963 1.223D-16 0.0027053
1.223D-16 1. - 3.311D-19
- 0.0027053 - 2.241D-22 - 0.9999963


Finally, I opened the FBX file in the "Transformation" example that comes with the SDK. It seems to complain about the camera, too.


Direct01
Error: The two global transform results are not equal!
KFbxEvaluatorGlobalTransform Row_0: -0.999996, -0.002706, 0.000000, 0.000000
KFbxEvaluatorGlobalTransform Row_1: -0.002706, 0.999996, 0.000000, 0.000000
KFbxEvaluatorGlobalTransform Row_2: -0.000000, 0.000000, -1.000000, 0.000000
KFbxEvaluatorGlobalTransform Row_3: -0.696054, 104.815559, 0.000002, 1.000000

FromScratchGlobalTransform Row_0: -0.999996, -0.002706, 0.000000, 0.000000
FromScratchGlobalTransform Row_1: 0.002706, -0.999996, -0.000000, 0.000000
FromScratchGlobalTransform Row_2: 0.000000, -0.000000, 1.000000, 0.000000
FromScratchGlobalTransform Row_3: -0.696054, 104.815559, 0.000002, 1.000000


So far, neither the evaluator or "scratch" global transforms match what I get when I dump the transform info with maxscript.

At this point, I'm a little lost as to what's going on. I've seen similar behavior when I look at a camera node. If anyone has any insight, I would certainly appreciate it!

(I also attached the FBX file that I've been using)

Thanks.
Message 3 of 3
Anonymous
in reply to: Anonymous

Hello DaveJs!

I forwarded your question to the principal dev and the following was his answer.

"Post rotations are applied to Cameras and Lights to compensate for the default orientation they have in the FBX SDK and in the different applications (3dsMax, Maya, etc…)

In the FBX SDK, a directional light that have a 0,0,0 rotation vector is pointing toward the –Y axis. The camera, with a 0,0,0 rotation vector is pointing toward the +X axis.

In 3dsMax the target light and free camera with a 0,0,0 rotation vector are both pointing toward the –Z axis. Hence, the required compensation (obtained by the Post-Rotation) so that these objects will point in the same direction when expressed in the Y-Up system (remember that the FBX file are always saved in a Y-Up space with units expressed in centimeters).

Also, because of the FBX SDK convention mentioned above, there is an extra operation involved when exporting from 3dsMax to FBX that is : the axis conversion to bring the whole scene into a Y-Up system. This can explain why the matrices you get with the Max script do not match the ones computed with the FBX SDK/FBX plug-in.

Hope this helped to explain what is happening."


Cheers!
Carlos

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

Post to forums  

Autodesk Design & Make Report