Scene Axis and Unit Conversion
Scene Axis and Unit Conversion
Objects in the FBX SDK are always created in the right handed, Y-Up axis system. The scene's axis system may need to be converted to suit your application's needs.
Consult the FbxAxisSystem class documentation for more information.
Important points about the FBX SDK system unit:
- If a reading application needs to determine the system unit in which the data was
created, then the original system unit is used as reference.
- A writing application must explicitly set the system unit.
- The implicit coordinate system is in centimeters. It means that a plane with coordinates (0,0,0), (1,0,0), (1,1,0), (0,1,0) and all
scaling/unit factors equal to one defines a "1x1 cm" plane.
A scene's axis and unit system can be respectively changed using the following functions:
Note that calls to ConvertScene() do not change the vertex values of meshes, and only affect node transforms and animations.
If the scene is already in the required axis system or required unit system, a call
to ConvertScene() will have no effect on the scene. For example:
- If the scene is already in the MayaZUp axis system, the code FbxAxisSystem::MayaZUp.ConvertScene(scene); will not change anything.
- If the scene is already in centimeters, the code FbxSystemUnit::cm.ConvertScene(scene); will not change anything.
NOTE:If your scene is improperly scaled after unit conversion, this might be caused by
different nodes inherit types (
ETransformInheritType), specifically the nodes with inherit type
eINHERIT_Rrs. To avoid this problem, make sure to avoid unit conversion on these nodes by using
the conversion options in the following code snippet. This code snippet additionally
illustrates how to convert a scene's units from centimeters (cm) into meters (m):
if(lScene->GetGlobalSettings().GetSystemUnit() == FbxSystemUnit::cm)
{
const FbxSystemUnit::FbxUnitConversionOptions lConversionOptions = {
false, /* mConvertRrsNodes */
true, /* mConvertAllLimits */
true, /* mConvertClusters */
true, /* mConvertLightIntensity */
true, /* mConvertPhotometricLProperties */
true /* mConvertCameraClipPlanes */
};
// Convert the scene to meters using the defined options.
FbxSystemUnit::m.ConvertScene(lScene, lConversionOptions);
}