Version: 2017.3
艺术资源最佳实践指南
FBX export guide

How do I import models from my 3D app?

There are two ways to import 3D models into Unity:

  • Drag the 3D model file from your file browser straight into the Unity Project window.
  • Copy the 3D model file into the Project’s Assets folder.

Select the file in the Project view and navigate to the Model tab in the Inspector window to configure import options. See documentation on Models for more information about import options.

Unity supports importing models from most popular 3D applications. For more guidance on how to import from specific 3D packages, see the following pages:

Textures

You must store Textures in a folder called Textures, placed inside the Assets folder (next to the exported Mesh) within your Unity Project. This enables the Unity Editor to find the Textures and connect them to the generated Materials. For more information, see documentation on Importing Textures.

3D formats

Unity supports importing Meshes from two different types of files:

  1. Exported 3D file formats, such as .fbx or .obj. You can export files from 3D modeling software in generic formats that can be imported and edited by a wide variety of different software.
  2. Proprietary 3D or DCC (Digital Content Creation) application files, such as .max and .blend file formats from 3D Studio Max or Blender, for example. You can only edit proprietary files in the software that created them. Proprietary files are generally not directly editable by other software without first being converted and imported. An exception to this is SketchUp .skp files, which both by SketchUp and Unity can read.

Unity 可以导入和使用这两种类型的文件,每种文件都有各自的优缺点。

Exported 3D files

Unity can read .fbx, .dae (Collada), .3ds, .dxf, .obj, and .skp files. Refer to your 3D modeling software documentation for information about exporting 3D files.

优点:

  • Instead of importing the whole model into Unity, you can import only the parts of the model you need.
  • 导出的通用文件通常小于专有的同等文件。
  • 使用导出的通用文件有利于采用模块化方法(例如,为碰撞类型或交互使用不同的组件)。
  • 可以从 Unity 不直接支持的软件导入这些文件。
  • Exported 3D files (.fbx, .obj) can be reimported into 3D modeling software after exporting, to ensure that all of the information has been exported correctly.

缺点:

  • Models must be re-exported manually if changes are made to the original file.
  • Extra care must be taken to keep track of versions between the source file and the files imported into Unity.

Proprietary 3D application files

Unity can import proprietary files from the following DCC software: Max, Maya, Blender, Cinema4D, Modo, Lightwave & Cheetah3D. Files imported this way are converted into .fbx files by Unity during the import process.

优点:

  • Updates made to the original model are automatically imported into Unity.
  • This is initially simple - but it can become more complex later in development.

缺点:

  • A licensed copy of the software used must be installed on all machines using the Unity project.
  • Software versions should be the same on each machine using the Unity project. Using a different software version can cause errors or unexpected behavior when importing 3D models.
  • 文件可能会因不必要的数据而变得臃肿。
  • Big files can slow down Unity project imports or Asset re-imports, because you have to run the DCC software you use as a background process when you import the model into Unity.
  • 在导入过程中,Unity 会在内部将专有文件导出到 .fbx。因此难以验证 .fbx 数据和进行故障排除。

Note: Assets saved as .ma, .mb, .max, .c4d, or .blend files fail to import unless you have the corresponding DCC software installed in your computer. This means that everybody working on your Unity project must have the correct software installed. For example, if you use Maya to create ExampleModel.mb and copy it into your project, anyone else opening that project also needs to have Maya installed on their computer.

Model Importer: Model

Model files that are placed in the Assets folder in your Unity project are automatically imported and stored as Unity Assets.

A model file can contain a 3D model, such as a character, a building, or a piece of furniture. The model is imported as multiple Assets. In the Project window, the main imported object is a model Prefab. Usually there are also several Mesh objects that are referenced by the model Prefab.

A model file can also contain animation data, which can be used to animate this model or other models. The animation data is imported as one or more Animation Clips.

A Mesh Filter together with the Mesh Renderer makes the model appear on screen
A Mesh Filter together with the Mesh Renderer makes the model appear on screen

Import settings for Meshes

The Import Settings for a model file is displayed in the Model tab of the FBX importer’s Inspector window when the model is selected. These affect the Mesh and its Normals. Settings are applied per Asset on disk, so if you need Assets with different settings, make (and rename accordingly) a duplicate file.

属性 功能
Meshes
Scale Factor Unity’s physics system expects 1 meter in the game world to be 1 unit in the imported file. If you prefer to model at a different scale then you can compensate for it here. Defaults for different 3D packages are as follows:
.fbx, .max, .jas, .c4d = 0.01
.mb, .ma, .lxo, .dxf, .blend, .dae = 1
.3ds = 0.1
Use File Scale Use the default model scaling, or uncheck to set a custom File Scale value for your model. Unity’s physics system expects 1 meter in the game world to be 1 unit in the imported file. If you prefer to model at a different scale then you can compensate for it here.
File Scale Set a custom scale for your model. Only available when Use File Scale is checked.
Mesh Compression Increasing this value reduces the file size of the Mesh, but might introduce irregularities. It’s best to turn it up as high as possible without the Mesh looking too different from the uncompressed version. This is useful for optimizing game size.
Read/Write Enabled If enabled, Mesh data is kept in memory so that a custom script can read and change it. Disabling this option saves memory, because Unity can unload a copy of Mesh data in the game. However, in certain cases when the Mesh is used with a Mesh Collider, this option must be enabled. These cases include:
- Negative scaling (for example, (–1, 1, 1)).
- Shear transform (for example, when a rotated Mesh has a scaled parent transform).
Optimize Mesh 让 Unity 确定三角形在网格中列出的顺序。Unity 会对顶点和索引重新排序以改善 GPU 性能。
Import BlendShapes Allow Unity to import BlendShapes with your Mesh.
Generate Colliders If this is enabled, your Meshes are imported with Mesh Colliders automatically attached. This is useful for quickly generating a collision Mesh for environment geometry, but should be avoided for geometry you are moving.
Keep Quads Unity can import any type of polygon ( triangle to N-gon ). Polygons that have more than 4 vertices are always converted to triangles. Quads are only converted to triangles if “Keep Quads” is off. Quads might be preferable over polygons when using Tessellation shaders. See documentation on Surface Shader Tessellation for more information.
Index Format Defines the size of the Mesh index buffer. Note: For bandwidth and memory storage size reasons, you generally want to keep 16 bit indices as default, and only use 32 bit when necessary.
Auto Allows Unity to choose whether to use 16 or 32 bit indices when importing a Mesh, depending on the Mesh vertex count. This is the default for assets added in Unity 2017.3 and onwards.
16 bit Makes Unity always use 16 bit indices when importing a Mesh. If the Mesh is larger, then it is split into <64k vertex chunks. Assets that already exist in projects made in Unity 2017.2 or previous versions will use this setting.
32 bit Makes Unity always use 32 bit indices when importing a Mesh. This might be useful if you are doing GPU-based rendering pipelines (for example with compute shader triangle culling). This ensures that all Meshes use the same index format and allows you to have simpler compute shaders, because they only need to handle one format.
Weld Vertices Combine vertices that share the same position in space. This optimizes the vertex count on Meshes by reducing their overall number. This option is enabled by default.

In some cases, you might need to switch this optimization off when importing your Meshes. For example, if you intentionally have duplicate vertices which occupy the same position in your Mesh, you may prefer to use scripting to read or manipulate the individual vertex or triangle data.
Import Visibility 导入 FBX 设置,这些设置定义了是否启用 MeshRenderer 组件(可见)。有关详细信息,请参阅下面的导入可见性
Import Cameras 从 .FBX 文件导入摄像机。有关详细信息,请参阅下面的导入摄像机
Import Lights 从 .FBX 文件导入光源。有关详细信息,请参阅下面的导入光源
Preserve Hierarchy Always create an explicit prefab root, even if this model only has a single root. Normally, the FBX Importer strips any empty root nodes from the model as an optimization strategy. However, if you have multiple FBX files with portions of the same hierarchy you can use this option to preserve the original hierarchy.

For example, file1.fbx contains a rig and a Mesh and file2.fbx contains the same rig but only the animation for that Mesh. If you import file2.fbx without enabling this option, the animation is imported without its rig, the hierarchies don’t match, and the animation breaks.
Swap UVs Swaps the primary and secondary UV channels in your Meshes. Use this option if your diffuse texture uses UVs from the lightmap.
Generate Lightmap UVs 为光照贴图创建第二个 UV 通道。请参阅有关光照贴图的文档以了解更多信息。
Normals & Tangents
Normals 定义是否以及如何计算法线。这对于优化游戏大小很有用。
Import Default option. Imports normals from the file.
Calculate Calculates normals based on Smoothing angle. If selected, the Smoothing Angle becomes enabled.
None Disables normals. Use this option if the Mesh is neither normal mapped nor affected by realtime lighting.
Normals Mode Define how the normals are calculated by Unity. This is only available when Normals is set to Calculate.
Unweighted Legacy The legacy method of computing the normals (prior to version 2017.1). In some cases it gives slightly different results compared to the current implementation. It is the default for all FBX prefabs imported before the migration of the project to the latest version of Unity.
Unweighted 法线不加权。
Area Weighted 法线按照图面面积加权。
Angle Weighted 法线按照每个图面上的顶角加权。
Area and Angle Weighted 法线按照每个图面上的图面面积和顶角加权。这是默认选项。
Tangents Defines how vertex tangents should be imported or calculated. This is only available when Normals is set to Calculate or Import.
Import Imports vertex tangents from FBX files if Normals is set to Import. If the Mesh has no tangents, it won’t work with normal-mapped shaders.
Calculate Tangent Space Calculates tangents using MikkTSpace. This is the default option if Normals is set to Calculate.
Calculate Legacy Calculates tangents with legacy algorithm.
Calculate Legacy - Split Tangent Calculates tangents with legacy algorithm, with splits across UV charts. Use this if normal map lighting is broken by seams on your Mesh. This usually only applies to characters.
None Does not import vertex tangents. The Mesh has no tangents, so won’t work with normal-mapped shaders.
Smoothing Angle Sets how sharp an edge has to be in order to be treated as a hard edge. It is also used to split normal map tangents.

导入可见性

Unity can read visibility properties from FBX files with the Import Visibility property.

Values and animation curves can enable or disable MeshRenderer components by controlling the Renderer.enabled property.

默认情况下,可见性是可以继承的(设置为 true),但可以覆盖。例如,如果父网格上的可见性设置为 0,那么其子网格上的所有渲染器也将被禁用。在此情况下,将为每个子项的 Renderer.enabled 属性创建一个动画曲线。

Some 3D modelling applications either do not support or have limitations regarding visibility properties. For more information, see:

导入摄像机

The following Camera properties are supported when importing Cameras from an .FBX file:

属性: 功能:
Projection 模式 正交或透视。不支持动画。
Field of View 支持动画。
NearFar Clipping Plane 距离 Does not support animation. When exporting from 3DSMax, enable the Clip Manually setting; otherwise the default values are applied on import.

Note: Targeted cameras are not supported.

导入光源

支持以下光源类型:

  • 全向光
  • 聚光灯
  • 方向光
  • 面光源

支持以下光源属性:

属性: 功能:
Range 如果启用 UseFarAttenuation__,则使用 FarAttenuationEndValueFarAttenuationEndValue__ 不支持动画。
Color 支持动画。
Intensity 支持动画。
Spot Angle 支持动画。仅适用于聚光灯。

Note: In 3DSMax, the exported default value is the value of the property at the current selected frame. To avoid confusion, move the playhead to frame 0 when exporting.

限制

Some 3D modelling applications apply scaling on light properties. For instance, you can scale a spot light by its hierarchy and affect the light cone. Unity does not do this, which may cause lights to look different in Unity.

The FBX format does not define the width and height of area lights. Some 3D modelling applications don’t have this property and only allow you to use scaling to define the rectangle area. Because of this, area lights always have a size of 1 when imported.

不支持目标光照动画,除非它们的动画经过烘焙。


  • 2017–09–04 页面已修订并只进行了有限的编辑审查

  • 2018–03–12 页面已修订并只进行了有限的编辑审查

  • 用户手册 5.6 版中首次记录了 Keep Quads 的现有(Unity 5.6 之前)功能

  • 在 Unity 2017.1 中添加了 Normals ModeLightCamera 导入选项 NewIn20171

  • 2017.2 中添加了 Materials 选项卡 NewIn20172

  • 2017.3 版中添加了 Index Format 属性 NewIn20173

  • Preserve Hierarchies added in 2017.3 NewIn20173

另请参阅

艺术资源最佳实践指南
FBX export guide