FBX导入指南
FBX is a file format owned by Autodesk that is used to provide interoperability between various Digital Content Creation (DCC) applications. Most of modern 3D modelling applications support export to FBX: Autodesk Maya, Autodesk 3ds Max, Blender, Modo, etc.FBX是Autodesk拥有的文件格式,用于提供各种数字内容创建(DCC)应用程序之间的互操作性。大多数现代3D建模应用程序都支持导出到FBX:Autodesk Maya,Autodesk 3ds Max,Blender,Modo等。
UNIGINE's FBX import pipeline allows simple transfer of content from any DCC application that supports this format.UNIGINE的FBX导入管道允许从支持该格式的任何DCC应用程序简单地传输内容。
The advantages of using FBX Import over other importing methods are:与其他导入方法相比,使用FBX导入的优点是:
- Static meshes, skeletal meshes, animations, and morph targets are combined in a single file format.静态网格物体,骨架网格物体,动画和变形目标以单个文件格式组合。
- Multiple assets can be contained in a single file.一个文件中可以包含多个资源。
- Import of multiple LODs and morph targets in a single import operation.在单个导入操作中导入多个LOD和变形目标。
- Materials and textures can be imported with and applied to meshes.材质和纹理可以与网格一起导入并应用于网格。
- Cameras and light sources can also be imported.摄像机和光源也可以导入。
Along with importing data from FBX containers, UNIGINE also provides an ability to export data to .fbx files.除了从FBX容器导入数据外,UNIGINE还提供了以下功能:将数据导出到.fbx文件。
Importing FBX Asset导入FBX资源#
When you import an FBX asset (just like importing any other asset), the import settings window appears:导入FBX资源时(就像进口任何其他资源),出现导入设置窗口:
The list of available import options covers all components that can be imported from an FBX scene and includes the following:可用的导入选项列表涵盖了可以从FBX场景导入的所有组件,包括以下内容:
Mesh Import Options网格导入选项#
Import Meshes | Import geometry meshes from the file.从文件导入几何体网格。 |
---|---|
Use Instances | Imports FBX with mesh instances. When enabled, a single mesh is imported instead of several identical ones. If you add such FBX to the scene, all meshes in the World Hierarchy will refer to the single mesh stored inside the imported FBX container.导入带有网格物体实例的FBX。启用后,将导入单个网格,而不是多个相同的网格。如果将此类FBX添加到场景中,则“世界层次”中的所有网格都将引用存储在导入的FBX容器内的单个网格。 |
Merge Static Meshes | Merges all of the children static meshes into a single one (named after the parent mesh). All surfaces of all meshes surfaces will be copied and shown in the Surfaces hierarchy.将所有子静态网格物体合并为一个(以父网格物体命名)。所有网格曲面的所有曲面都将被复制并显示在Surfaces层次结构中。 |
Merge Surfaces by Materials | Enables merging surfaces that have the same materials.启用具有相同材质的合并曲面。 |
Split by Grid |
Enables splitting of imported meshes. Too large models having sizes, that exceed 10000 units may have various artefacts (jitter, etc.) associated with positioning errors. You can eliminate such artefacts by splitting your mesh into multiple separate meshes. To do so, just enable this option and set the size of the grid cell (see the Grid Size parameter below) to be used for mesh splitting.启用导入网格的拆分。尺寸超过10000单位的模型太大,可能会出现与定位误差相关的各种伪像(抖动等)。您可以通过将网格划分为多个单独的网格来消除此类伪影。为此,只需启用此选项并设置用于网格划分的网格单元的大小(请参见下面的Grid Size参数)。 This option does not split surfaces.此选项不会拆分曲面。 |
Grid Size | Size of the grid cell to split imported meshes, in units.划分导入的网格的网格单元的大小,以单位为单位。 |
Repivot to Center | Places a pivot of generated mesh to its center. Can be used for meshes having their geometry located too far from their pivot, as this may lead to various artefacts (jitter, etc.) associated with positioning errors.将生成的网格的枢轴放置到其中心。可以用于其几何形状离其轴心太远的网格,因为这可能导致与定位误差相关的各种伪像(抖动等)。 |
Optimize Vertex Cache | Enables vertex cache optimization. This option reorders an indexed triangle list to improve vertex cache utilization at runtime. It can be turned off to accelerate saving process; however, it should always be turned on if saving the final version.启用顶点缓存优化。此选项对索引的三角形列表重新排序,以提高运行时的顶点缓存利用率。可以将其关闭以加快保存过程;但是,如果保存最终版本,则应始终将其打开。 |
Correct Triangulation |
Enables correct triangulation of meshes, NURBS and patches.启用网格,NURBS和面片的正确三角剖分。 Disabling this option decreases import time, but may lead to triangulation errors resulting in incorrect geometry.禁用此选项会减少导入时间,但可能会导致三角剖分错误,从而导致几何图形不正确。 |
Import Tangent Space |
Imports built-in tangent space data instead of recalculating it.导入内置切线空间数据,而不是重新计算。 If the option is checked, but an FBX asset has no tangent space, it will be calculated with orientation for the right-handed coordinate system.如果选中该选项,但是FBX资源没有切线空间,则将使用右手坐标系的方向进行计算。 |
Import Morph Targets | Enables importing morph targets from the file.允许从文件导入变形目标。 |
Morph Target Normals |
The morph target import parameter that defines how the normals of the morph target are imported. Three modes are available:变形目标(morph target)导入参数,该参数定义了如何导入变形目标的法线。有三种模式:
|
Use LODs | Defines if Levels of Detail (LODs) are to be used for the imported model, as well as the LOD creation and configuration mode.定义是否将自动创建详细级别(LOD)用于导入的模型,以及LOD创建和配置模式。 |
Levels of Detail详细程度#
To create several variations of one object with different level of detail (LODs) you should have them as separate surfaces of the object. This will allow you to reduce the number of nodes in the hierarchy and simplify the settings of the LODs visibility.为一个具有不同详细程度的对象创建多个变体(检出限),则应将它们作为对象的单独表面。这将允许您减少层次结构中的节点数量,并简化LOD可见性的设置。
UNIGINE provides automatic assignment and configuration of Levels of Detail based on the name postfixes, enabling you to create and export different meshes for different LODs of your model in a single FBX file. When naming these meshes, you should add a postfix to specify the LOD each mesh represents. You can also specify visibility and fade distances for each LOD of your model at the importing stage, saving time, as you don't have to adjust these settings for the surfaces on the scene - choose Combine by Postfixes in the Use LODs dropdown.UNIGINE 提供基于名称后缀的详细级别的自动分配和配置,使您能够在单个 FBX 文件中为模型的不同 LOD 创建和导出不同的网格。在命名这些网格时,您应该添加一个后缀来指定每个网格所代表的 LOD。您还可以在导入阶段为模型的每个 LOD 指定可见性和渐变距离,从而节省时间,因为您不必为场景中的表面调整这些设置:在 Use LODs 下拉列表中选择 Combine by Postfixes。
You can also enable the Merge Static Meshes option for more optimization.您还可以启用Merge Static Meshes选项以进行更多优化。
-
The morph target import parameter that defines how the normals of the morph target are imported. Three modes are available:在 Use LODs 下拉列表中选择 Combine by Postfixes。
This will show additional LODs settings:这将显示其他LOD设置:
- Select the number of LODs that are stored in the FBX container.选择存储在FBX容器中的LOD数量。
-
For each LOD, define a postfix that will be used to group objects in an FBX file into a corresponding LOD.对于每个LOD,定义一个后缀,该后缀将用于将FBX文件中的对象分组为相应的LOD。
The postfix must be the same as the one used when creating objects in a 3D editor.后缀必须与在3D编辑器中创建对象时使用的后缀相同。The names of generated surfaces will be as follows: material_name + LOD_postfix.生成的曲面的名称如下:material_name + LOD_postfix。
- Specify the minimum and maximum visibility and fade distances for each LOD.指定每个LOD的最小可见距离。每个LOD的最大可见距离等于下一个LOD的最小可见距离。最后一个LOD的最大可见距离等于inf。
Automatic Generation of LODs自动生成 LOD#
Automatic LOD Generation feature based on the meshoptimizer library will help in case you only have a high-poly model, saving you a lot of time on preparing levels of detail manually.自动 LOD 生成功能基于meshoptimizer 库将在您只有一个高多边形模型的情况下提供帮助,从而为您节省大量手动准备细节级别的时间。
To use the feature choose Auto-Generated in the Use LODs dropdown and configure the settings listed below - the Engine will do the rest, generating all LODs automatically based on your configuration.要使用该功能,请在 Use LODs 下拉列表中选择 Auto-Generated 并配置下面列出的设置 - 引擎将完成剩下的工作,并根据您的配置自动生成所有 LOD。
Lightmaps Options光照贴图选项#
Hierarchy Options层次结构选项#
This auxiliary section is available in the Parameters window when selecting an imported FBX asset in the Asset Browser. It enables you to preview the content of the FBX asset according to the current Mesh Import Options.在资源浏览器中选择导入的FBX资源时,该辅助部分可在Parameters窗口中使用。它使您可以根据当前预览FBX资源的内容。网格导入选项。
Nodes | List of nodes obtained from the FBX asset.从FBX资源获得的节点列表。 |
---|---|
Surfaces | List of surfaces of the selected node.所选节点的曲面列表。 |
Use Custom Settings | Enables custom Lightmaps options for the selected surface(s).启用自定义光照贴图选定表面的选项。 |
Material Import Options物料导入选项#
Import Materials | Enables importing materials from the file.启用从文件导入材质。 |
---|---|
Assets Mode |
Enables to choose whether to use existing materials or to overwrite them with the ones imported. Available options:允许选择是使用现有材质还是用导入的材质覆盖它们。可用选项:
|
Base Material Mode |
可以选择进口材质的基材。可用选项:
|
Workflow |
Provides an interface to choose a workflow for the imported physically based materials (if any). Available options:提供一个界面来选择工作流程进口的基于物理的材质(如果有)。可用选项: |
Add Asset Name as Prefix | Enables to add a prefix for imported materials to avoid collision of names.允许为导入的材质添加前缀,以避免名称冲突。 |
Add Prefix | Enabling this option makes the name of each material have the name of the imported FBX asset as a prefix.启用此选项会使每种材质的名称具有导入的FBX资源的名称作为前缀。 |
Merge Similar Materials | Enables to merge materials with the same settings, but different names.可以合并具有相同设置但名称不同的材质。 |
Animation Import Options动画导入选项#
Import Animations | Enables importing animations from the file.允许从文件导入动画。 |
---|---|
Import Bones Without Skin | Enables import of bones that are not attached to the skeleton and do not affect the animation's skin, for example, a weapon held in the character's hands. If disabled, such bone is not imported and bones connected to it, if any, become orphans.允许导入未连接到骨架且不影响动画皮肤的骨骼,例如,角色手中持有的武器。如果禁用,则不会导入此类骨骼,并且与之相连的骨骼(如果有)将成为孤儿。 |
Create Transform Bones for Joints | Imports the hierarchy of the joints (bones) for animated FBX assets as a list of World Transform Bones. If this option is disabled, imported animations for a mesh will still work.导入动画FBX资源的关节(骨骼)的层次结构作为World Transform Bones的列表。如果禁用此选项,导入的动画对于网格仍然可以使用。 |
Joints Reorientation | Enables changing orientation of bones for animations and animated geometry. When enabled, all bones will have the same forward axis as the geometry. This simplifies work with animations via code for programmers reducing excessive axis manipulations: if a mesh has +Y as a forward axis, the bones will have +Y as well.为动画和动画几何体启用更改骨骼的方向。启用后,所有骨骼的前向轴将与几何图形相同。这为程序员简化了通过代码进行动画处理的工作,减少了过多的轴操作:如果网格的前向轴为+Y,则骨骼也将为+Y。 |
Animation FPS | Number of frames per second of imported animation.每秒导入的动画的帧数。 |
Force Loop |
Forced smoothing of looped animation playback.强制平滑循环动画的播放。 |
Looped Frames | Number of frames to be used for smoothing of looped animation playback. The specified number of frames is taken from the beginning and from the end of the animation. If the specified value exceeds the (total_number_of_frames)/2, the latter is used instead.用于平滑循环播放动画的帧数。指定的帧数是从动画的开头和结尾开始获取的。如果指定的值超过(total_number_of_frames)/2,则使用后者。 |
Other Import Options其他导入选项#
Import Textures | Enables importing textures from the file.启用从文件导入纹理。 |
---|---|
Import Lights | Imports light sources from an FBX scene.从FBX场景导入光源。 |
Import Cameras | Imports cameras from an FBX scene.从FBX场景导入摄像机。 |
Skip Empty Nodes | Enables skipping empty nodes. Complex CAD models may contain a lot of empty nodes, resulting in an overloaded world hierarchy. You can enable this option to simplify generated hierarchy by ignoring nodes, that do not contain any useful information.启用跳过空节点。复杂的CAD模型可能包含许多空节点,从而导致世界层次结构过载。您可以启用此选项,以通过忽略不包含任何有用信息的节点来简化生成的层次结构。 |
Front Axis | Provides an interface to choose an axis to be considered as the forward vector of the World Coordinate System.提供一个接口,以选择要被视为世界坐标系的正向向量的轴。 |
Up Axis | Provides an interface to choose an axis to be considered as the up vector of the World Coordinate System.提供一个接口,以选择要被视为世界坐标系的向上向量的轴。 |
Scale |
Geometry scale multiplier.几何比例乘数。 When added to the scene in UNIGINE, your mesh might require scaling to fit properly. However, applying the Scale transformation to the mesh affects its physics — the mesh cannot participate in collision properly in this case. Therefore, it is recommended to define the required scale value using the scale manipulator and then re-import the mesh using the resulting value, which is displayed in the Common Parameters.当在UNIGINE中添加到场景中时,您的网格可能需要缩放以正确适合。但是,将Scale转换应用于网格会影响其物理效果-在这种情况下,网格无法正确参与碰撞。因此,建议使用规模操纵器然后使用结果值重新导入网格,该值显示在常用参数。 |
Specific options for various types of data stored in an FBX container are described below.下面描述了存储在FBX容器中的各种类型数据的特定选项。
Geometry几何学#
The most commonly used type of data stored in an FBX container is polygonal geometry.FBX容器中存储的最常用数据类型是多边形几何。
When importing geometry keep in mind the following mesh limitations set in UNIGINE:在导入几何图形时,请记住以下在UNIGINE中设置的网格限制:
Maximum number of vertices per mesh每个网格的最大顶点数 | 4294967295 |
Maximum number of surfaces per mesh每目最大表面数 | 32768 |
Maximum amount of weights per vertex每个顶点的最大权重数 | 4 |
To import 3D geometry data contained in an FBX scene, you should enable the Import Meshes option.要导入FBX场景中包含的3D几何数据,应启用Import Meshes选项。
Imported geometry (same as any object in the scene) after being added to the world, becomes a node and can be seen in the World Hierarchy window. This node will have the same name as the imported FBX asset and a hierarchy of child nodes representing the hierarchy of static meshes contained in the imported scene. 导入的几何图形(与场景中的任何对象相同)在添加到世界后变为节点并可以在World Hierarchy窗口中看到。该节点的名称与导入的FBX资源的名称相同,子节点的层次结构表示包含在导入场景中的静态网格物体的层次结构。 |
You can combine all child objects into a single one by enabling the Merge Static Meshes option. In this case, all surfaces of child meshes will be copied to the single parent mesh and will appear in its Surfaces hierarchy.您可以通过启用Merge Static Meshes选项将所有子对象合并为一个。在这种情况下,子网格物体的所有表面将被复制到单个父网格物体,并将出现在其Surfaces层次结构中。
You can also merge the surfaces having the same material assigned by enabling the Merge Surfaces by Materials option.您也可以通过启用Merge Surfaces by Materials选项合并具有相同材质的曲面。
Different measurement systems can be used in different 3D modelling applications. To adjust the scale of imported geometry, you can use the Scale parameter.可以在不同的3D建模应用程序中使用不同的测量系统。要调整导入几何的比例,可以使用Scale参数。
It is also possible to optimize the vertex cache when importing geometry. To do so, use the Optimize Vertex Cache option.导入几何体时也可以优化顶点缓存。为此,请使用Optimize Vertex Cache选项。
The Import Tangent Space option allows importing built-in tangent space data instead of recalculating it.Import Tangent Space选项允许导入内置切线空间数据,而无需重新计算。
Materials材质#
An FBX container can also store materials assigned to the surfaces of the objects in a 3D editor.FBX容器还可以在3D编辑器中存储分配给对象表面的材质。
To import materials from an FBX container, you should enable the Import Materials option. In this case, the surfaces of the imported model will have the corresponding materials assigned.要从FBX容器导入材质,应启用Import Materials选项。在这种情况下,将为导入的模型的曲面分配相应的材质。
The following textures will be imported and assigned (if any):以下纹理将被导入和分配(如果有):
- Diffuse (albedo) texture
- Normal map or bump map (needs to be converted into 2-channel (RG) for Unigine)
- Specular texture
- Light map
The following material parameters will also be imported (if defined):还将导入以下材质参数(如果已定义):
- Diffuse color
- Specular color and power
- Emission color
When the Import Materials option is disabled, all surfaces of the model will have the default mesh_base material assigned. 禁用Import Materials选项时,将为模型的所有曲面分配默认的mesh_base材质。
When importing materials, you might have a situation when a material with a given name already exists in the project. You can choose whether to overwrite existing materials (the corresponding assets will be overwritten) or not. For this purpose, the Overwrite Existing Materials option is used. When unchecked, existing materials will be used.导入材质时,项目中可能已经存在具有给定名称的材质。您可以选择是否覆盖现有材质(对应的资源将被覆盖)。为此,使用了Overwrite Existing Materials选项。如果未选中,则将使用现有材质。
In case when a source model contains lots of objects with many identical materials that just have different names (often happens when an FBX file was exported from a CAD system), it makes sense to combine such materials into a single one. To do so, you should enable the Merge Similar Materials option.如果源模型包含许多具有许多相同材质但名称不同的对象(通常是从FBX文件中导出FBX文件时发生的)电脑辅助设计系统),将这些材质合并为一个材质是有意义的。为此,您应该启用Merge Similar Materials选项。
UNIGINE支持两种PBR材质工作流程:Metalness和Specular。使用Workflow选项设置所需的工作流程。
Textures贴图#
When reading the materials data, you are also able to import textures stored in an FBX container. To do so, enable the Import Textures option.读取材质数据时,您还可以导入存储在FBX容器中的纹理。为此,启用Import Textures选项。
Animation and Morph Targets动画和变形目标#
You can import skeletal animations and morph targets from an FBX file.您可以从FBX文件导入骨骼动画和变形目标。
To import animations from an FBX container:要从FBX容器导入动画,请执行以下操作:
- Enable the Import Animations option.启用Import Animations选项。
- Specify the number of frames per second for imported animation in the Animation FPS field.在Animation FPS字段中为导入的动画指定每秒的帧数。
To import morph targets just enable the Import Morph Targets option. Morph targets will be imported as child nodes.要导入变形目标,只需启用Import Morph Targets选项。变形目标将作为子节点导入。
If you have an FBX file containing skeletal animation without any geometry, you can import it to your UNIGINE project via the Import Bones Without Skin and use generated .anim files.如果您有一个FBX文件,其中包含没有任何几何图形的骨骼动画,则可以通过Import Bones Without Skin将其导入到UNIGINE项目中,并使用生成的.anim文件。
Lights灯#
You can import light sources from an FBX scene (if any) by simply enabling the Import Lights option. Imported light sources will be added as child nodes to the root node. The following conversion will be performed:您可以通过简单地启用Import Lights选项从FBX场景导入光源(如果有)。导入的光源将作为子节点添加到根节点。将执行以下转换:
- Directional lights are converted into world light sources.定向光将转换为world光源。
- Point lights are converted into omni light sources.点光源将转换为omni光源。
- Spot lights are converted into projected light sources.聚光灯转换为projected光源。
The following parameters of lights are automatically imported into UNIGINE, so there is no need to set them up twice:以下灯光参数会自动导入到UNIGINE中,因此无需将它们设置两次:
- Light color浅色
- Light radius and attenuation光半径和衰减
- Light source position and orientation光源位置和方向
Cameras摄影机#
Cameras can also be imported from an FBX scene (if they exist) by simply enabling the Import Cameras option. They are converted into PlayerDummy (cameras without physical properties). Both types of projection are supported in UNIGINE:只需启用Import Cameras选项,也可以从FBX场景导入摄像机(如果存在)。它们被转换为PlayerDummy(没有物理属性的相机)。 UNIGINE支持两种类型的投影:
- Orthographic (with Z near and far clipping planes support)正交(具有Z远近裁剪平面支持)
- Perspective (with FOV support)透视图(在FOV支持下)
To view the scene through the imported camera choose its name in the drop-down list in the top left corner of the Editor Viewport window.要通过导入的摄像机查看场景,请在Editor Viewport窗口左上角的下拉列表中选择其名称。
Adding Imported FBX Asset to the World将导入的FBX资源添加到世界#
To add a new imported FBX asset to the scene, as any other asset, simply drag it from the Asset Browser to the Viewport window. The corresponding node will be created and displayed in the World Hierarchy window. This node will have the same name as the imported FBX asset and a hierarchy of child nodes representing separate objects contained in the 3D model.要将新导入的FBX资源与其他资源一样添加到场景中,只需将其从Asset Browser拖动到Viewport窗口即可。相应的节点将被创建并显示在World Hierarchy窗口中。该节点的名称与导入的FBX资源的名称相同,并且子节点的层次结构代表3D模型中包含的单独对象。
Non-native geometry asset types (fbx, obj, dae, etc.) are containers for meshes. If you double-click such asset in the Asset Browser (or use the right-click Open command), the generated runtime .mesh, .anim and .node files stored in the container asset will be displayed:非本机几何图形资源类型(fbx, obj, dae等)是网格的容器。如果您在Asset Browser中双击此类资源(或使用右键单击Open命令),则生成的运行时将显示存储在容器资源中的.mesh, .anim和.node文件: