Uninomicon

Documenting the dark corners of the Unity Engine.

User Tools

Site Tools


fbx_importing

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
fbx_importing [2021/03/15 01:30]
73.95.178.156 [Blender]
fbx_importing [2022/01/26 20:53] (current)
uninomiconadmin
Line 1: Line 1:
 ====== FBX Importing ====== ====== FBX Importing ======
  
-Importing FBX files in Unity with the correct scale, rotation, and axis is fraught.+Importing FBX files in Unity with the correct scale, rotation, and axis is fraught. 
  
-===== Unit Scaling =====+If you are just looking for a quick way to get models importing into Unity properly, take a look at the [[https://pontoco.notion.site/Pontoco-FBX-Import-Export-Settings-7b363beb7f7249f2bca6d6bdbcae6c5d|Pontoco Import/Export Settings]].
  
-FBX files seems to be in cm by default, but can support other units. Other unit scales are achieved in FBX by by setting ''GlobalSettings->Properties70->UnitScaleFactor'' property in the file. For example, a 1 meter cube in 'meters' should be stored in an fbx file like:+The [[https://github.com/AStrangerGravity/fbx-sanitizer|FBX Sanitizer]] tool can be used to validate an FBX file to verify that it will import into Unity with correct scale and rotation. 
 +----- 
 +===== Scaling ===== 
 + 
 +FBX is in cm by default, but can support other units. Other unit scales are achieved in FBX by by setting ''GlobalSettings->Properties70->UnitScaleFactor'' property in the fbx. For example, a 1 meter cube in 'meters' should be stored in an fbx file like:
 <code yaml> <code yaml>
 GlobalSettings: GlobalSettings:
Line 14: Line 18:
 </code> </code>
  
-This file will show up in Unity's importer as '1m (File)'+This file will show up in Unity's importer as '1m (File)'[[https://uninomicon.com/_detail/unity_uhvnfc5tw5.png|image]] 
  
-{{:unity_uhvnfc5tw5.png}} +++++ Instructions for Blender |
- +
-==== Blender ====+
  
 In order to achieve the above scaling (scale of 1 on objects, UnitScaleFactor=100), in the export settings set one of the following for ''Transform->Apply Scaling'': In order to achieve the above scaling (scale of 1 on objects, UnitScaleFactor=100), in the export settings set one of the following for ''Transform->Apply Scaling'':
Line 24: Line 26:
   * FBX All   * FBX All
  
 +++++
 +
 +
 +++++ Instructions for Maya |
 +
 +Maya is not able to export in Meters without applying a scale to the object. This is because Maya works in a CM unit internally, even if you set it to display meters. If you want to get a unit transform when importing to Unity, you must model in cm, //pretending// that you're modeling in meters. Then, import into Unity with the 'Convert File Units' checkbox unchecked.
 +
 +This has the unfortunate result that these FBX files will import extremely tiny in any other program (like Blender). However, it's the only way we've found to get Maya to export to Unity without a scale. 
    
 +++++
 +
 +++++ 3DS Max |
 +
 +3DS Max can export in meters if you set the "System Unit" to Meters. See the [[https://www.notion.so/Pontoco-FBX-Import-Export-Settings-7b363beb7f7249f2bca6d6bdbcae6c5d|Pontoco Import/Export Settings]].
 + 
 +++++
 +
 +
 +------
 +
 ===== Rotation ===== ===== Rotation =====
  
Line 33: Line 54:
   * OriginalUpAxis: ??? <sup>[//[[:wiki:tag:research-needed|research needed]]//]</sup>   * OriginalUpAxis: ??? <sup>[//[[:wiki:tag:research-needed|research needed]]//]</sup>
  
-Unity uses these properties to determine the coordinate system for the file. On import, the asset will be rotated to convert it from the file-coordinate system, to the Unity coordinate system. __As of 2020.1, when "Bake Axis Conversion" is checked, these rotations will be baked into the meshes, rather than applied in the transforms.__+Unity uses these properties to determine the coordinate system for the file. On import, the asset will be rotated to convert it from the file-coordinate system, to the Unity coordinate system. As of 2020.1, when "Bake Axis Conversion" is checked, these rotations will be baked into the meshes, rather than applied in the transforms.
  
-==== Blender ====+For **Blender** it's important to note the difference between the terms "Front" and "Forward". Front refers to the direction a model //faces//. In Blender this is -Y, in Unity this is +Z. Forward refers to the direction you would walk when looking at a model from the front. In Blender this is +Y and in Unity this is +Z. ((At some point pre 2015, Blender [[https://developer.blender.org/T43935|incorrectly had these terms swapped]] and exported all models with a 180 flip because of it.))
  
 ++++ Instructions for Blender ~2.92 | ++++ Instructions for Blender ~2.92 |
-{{:blender_5lcugkdlz1.png}} +Unity's 'Bake Axis Conversion' checkbox is [[https://forum.unity.com/threads/bake-axis-conversion-import-setting.899072/#post-6975023|buggy]], however it seems to be the most reliable way to get the correct rotation from objects exported from Blender.  
-{{:unity_4iszlno6j5.png}}+ 
 + 
 +In Blender 2.92, the export behavior changed slightly, so we can simply: 
 +  * Axis must be set as -Y Forward ((because of the previous bug, this is 180 degrees opposite to the correct axis. Blend files naturally have a +Y Forward aka. -Y Front orientation for axis)), and Z Up. ((Blender coordinates)) 
 +  * "Use Space Transform" **must** be off. ((This feature was, [[https://forum.unity.com/threads/bake-axis-conversion-defaults-to-models-looking-backwards.910298/|interestingly]], built to help export to Unity properly. However, this actually adds a root rotation to the file, which can confuse other tools)) 
 +  * In Unity, select: "Bake Axis Conversion" 
 +{{ :blender_6pdtp5vutg.png }} 
 +{{ :unity_4iszlno6j5.png }}
 ++++ ++++
-++++ Instructions for Blender ~2.83 +++++ Instructions for Blender ~2.90 
-In Blender 2.83, you **must** select "!Experimental! Apply Transforms". In Unity, "Bake Axis Conversion" must be **off**. +Note! This path is buggy. Blender does not seem to apply transforms to objects deeper than parents in the hierarchyRecommended not to use this path. 
-{{:blender_6pdtp5vutg.png}} + 
-{{:unity_4iszlno6j5.png}}+  Select "!Experimental! Apply Transforms" 
 +  * Axis must be set as -Z Forward, and Y Up. 
 +  * In Unity, "Bake Axis Conversion" must be **off**. 
 +{{ :blender_5lcugkdlz1.png }} 
 +{{ :unity_4iszlno6j5.png }}
  
 //Note: If your object does not support Apply Transforms, you should either [[https://www.immersivelimit.com/tutorials/blender-to-unity-export-correct-scale-rotation|counter-rotate]] the object, or upgrade to Blender >2.92.// //Note: If your object does not support Apply Transforms, you should either [[https://www.immersivelimit.com/tutorials/blender-to-unity-export-correct-scale-rotation|counter-rotate]] the object, or upgrade to Blender >2.92.//
 +++++
 +
 +++++ Instructions for Maya |
 +Maya uses the same coordinate space as Unity. Just use the default export settings!
 +++++
 +
 +++++ Instructions for 3DS Max |
 +Max uses a Z up coordinate space. 
 +1. Make sure to always have "Z-Up" selected when exporting in the FBX Exporter.
 +2. Check the "Bake Axis Conversions" box in the Unity importer. Unity will correct the coordinate axis.
 ++++ ++++
fbx_importing.1615771829.txt.gz · Last modified: 2021/03/15 01:30 by 73.95.178.156