06 - Unit Sizes And Scale Factors



During the first weeks of the project we exported models without paying much attention to the scale factor. Due to this lack of attention our objects had different unit sizes, varying from 0.01 to 100. Naturally this made updating objects unnecessarily complicated. But the most significant problem was related to the physics simulation inside Unity. Everything somehow got very big which distorted the physical behavior and finding correct values for controlling the character was a hard task. Furthermore it had a negative impact on the number of lightmaps as those are generated relative to the world size of an object.

We finally decided to cleanup our structure and set appropriate scales to all objects. Problem is, the scale factor can be set on export and on import in all programs involved. If you are working alone on your game this is not problematic, but if you are  working in a team you have to agree on the same scale settings. In our case this meant to agree on Qubicle’s FBX export unit size as well as on Maya’s FBX import and export unit size.



After we had done this and re-exported all objects with the same unit size settings we were finally able to determine the scale factor in Unity: we took the Gravity Knight as our reference object whom we wanted to be 2 meters high. Because a unit in Unity is equal to 1m we placed him next to 2 default cubes and adjusted the Scale Factor of the import settings until the knight was nearly as big as the cubes. Since all objects were built in relative proportions to him - meaning 1 voxel of a wall has the same size as 1 voxel of the knight - we were then able to apply the scale to all other objects. Afterwards physics simulations and character controls behaved as expected and we were able to file this issue under "lessons learned".

Differences Between FBX And Collada

A thing we realized during the creation of the game is the fact that unit scales are handled differently by Collada and FBX. If you use 1 for unit size in the Collada export settings then in Unity a voxel is indeed as high as a default cube (1m). FBX's internal unit size is cm, so to get the same result you have to use 100 for the unit scale factor.

In this image you can see FBX export results for unit scales of 1, 10 and 100.

    Attachments
    There are no attachments for this article.