FBX Units and Scaling

Anonymous

FBX Units and Scaling

Anonymous
Not applicable

This has become a topic of debate among some coworkers and I was hoping to get an official clarification from Autodesk to clear it up.  Since there is no published specification for the FBX format, there is a disagreement around how to interpret the vertex and scaling data.  My reading of the relevant documentation here and here is that the units for the FBX vertices are in centimeters, meaning that the raw vertex coordinates can be in any units but once the scaling factor included in the file is applied, the end result is coordinates in centimeters. 

 

As an example, if I had an ASCII FBX with the following portions:

P: "UnitScaleFactor", "double", "Number", "",0.1

and

Vertices: *24 {
                                                a: 0,0,0,0,0,25.4,25.4,0,0,25.4,0,25.4,25.4,25.4,0,25.4,25.4,25.4,0,25.4,0,0,25.4,25.4
                                }

 

The correct way to interpret this is that it represents a 1 inch/2.54 cm cube and the raw vertex data, before scaling, is implied to be in millimeters since the scaling factor is 0.1.

0 Likes
Reply
3,302 Views
1 Reply
Reply (1)

regalir
Autodesk
Autodesk

Actually, the FBX file is "unitless" but the default behavior is to assume that it represent centimeters. However, the interpretation really depend on the application that read the file. In other words,  suppose that your application read the file as is without applying any unit conversion, you then end up with a cube that is 25.4 units wide in your application world. If your world is the inch, the cube would be 25.4 inches wide.If your world is the centimeter, the cube would be 25.4 centimeters wide.

 

To avoid this "arbitrary" interpretation, we introduced the UnitScaleFactor to represent the multiplier needed to convert the "implied" centimeter to the units we want the file to be represented in. So, in this case, with a factor of 0.1, the meaning is: this file "unit" is defined in millimeter and the cube is 25.4 millimeters wide.

 

Your application can then read the file and know that the 25.4 value in the raw data really is 25.4 millimeters. However, you should not bother directly with all these values. The proper way to read the FBX files is to define an FbxUnitSystem object to convert the scene to the desired system units. For example, if your application is working in inches, calling:

 

FbxSystemUnit::Inch.ConvertScene(lScene);

 

will convert the unit system of the scene from the millimeters to inches and the cube that was 25.4 millimeters wide would display as a 1 inch wide cube. The raw data values do not change but the scale property of the cube will be adjusted with the correct scale factor. In this case: 0.03937 (1 mm = 0.03937 inches).

 

0 Likes