для этой страницы,
отображается код на другом
FBX Import Guide
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.
UNIGINE's FBX import pipeline allows simple transfer of content from any DCC application that supports this format.
The advantages of using FBX Import over other importing methods are:
- 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.
- 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.
Importing FBX Asset
When you import an FBX asset (just like importing any other asset), the import settings window appears:
The list of available import options covers all components that can be imported from an FBX scene and includes the following:
|Import Meshes||Import geometry meshes from the file.|
|Merge Static Meshes||Merges all of the children static meshes in one (names it after the parent mesh). All of the meshes surfaces will be copied and shown in the Surfaces hierarchy.|
|Merge Surfaces by Materials||Enables merging surfaces that have the same materials.|
|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.|
|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.
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.|
|Import Joints||Imports the hierarchy of the joints (bones) for animated FBX assets. Joints are imported as a hierarchy of Dummy nodes. If this option is disabled, imported animations for a mesh will still work.|
|Import Lights||Imports light sources from an FBX scene.|
|Import Cameras||Imports cameras from an FBX scene.|
|Import Materials||Enables importing materials from the file.|
|Merge Similar Materials||Enables merging of materials with the same settings, but different names.|
|Overwrite Existing Materials||Enables to choose whether to overwrite materials that exist in the project or not. When unchecked, existing materials will be used.|
|Import Textures||Enables importing textures from the file.|
|Import Animations||Enables importing animations from the file.|
|Import Bones Without Skin||Enables importing animation skeletons without a skin from the file. If you have an FBX file containing skeletal animation without any geometry, you can import it to your UNIGINE project and use generated .anim files.|
|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.
|Import Morph Targets||Enables importing morph targets from the file.|
|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 ignoging nodes, that do not contain any useful information.|
|Correct Triangulation||Enables correct triangulation of meshes, NURBS and patches.
Disabling this option decreases import time, but may lead to triangulation errors resulting in incorrect geometry.
|Up Axis||Provides an interface to choose an axis to be considered as the up vector of the World Coordinate System.|
|Front Axis||Provides an interface to choose an axis to be considered as the forward vector of the World Coordinate System.|
|Workflow||Provides an interface to choose a workflow for the imported physically based materials (if any).
|Scale||Geometry scale multiplier.|
|Animation FPS||Number of frames per second of imported animation.|
|Combine by Postfixes||Enables automatic creation of the Levels of Detail (LODs).|
Specific options for various types of data stored in an FBX container are described below.
The most commonly used type of data stored in an FBX container is polygonal geometry.
To import 3D geometry data contained in an FBX scene, you should enable the Import Meshes option.
|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.|
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.
You can also merge the surfaces having the same material assigned by enabling the Merge Surfaces by Materials option.
Different measurement systems can be used in different 3D modelling applications. To adjust the scale of imported geometry, you can use the Scale parameter.
It is also possible to optimize the vertex cache when importing geometry. To do so, use the Optimize Vertex Cache option.
The Import Tangent Space option allows importing built-in tangent space data instead of recalculating it.
An FBX container can also store materials assigned to the surfaces of the objects in a 3D editor.
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.
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
- 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.
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.
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.
UNIGINE supports two workflows for PBR materials: Metalness and Specular. Use the Workflow option to set the desired workflow.
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.
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.
UNIGINE provides automatic creation of LODs based on the name postfixes. So you can create and export different meshes for different LODs of you 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 enable the Merge Static Meshes option for more optimization.
Firstly, enable the Combine by Postfixes parameter.
This will show additional LODs settings:
Max Count Number of Levels of Detail. Postfix Surface name postfix that determines the current LOD. Min Visibility The minimum distance on what this LOD is visible in camera local axes. -inf - the LOD is visible by default.
- Select the number of LODs that are stored in the FBX container.
- For each LOD define a postfix that will be used to group objects in an FBX-file into a corresponding LOD. The names of generated surfaces will be as follows: material_name + LOD_postfix.The postfix must be the same as the one used when creating objects in a 3D editor.
- Specify minimum visibility distance for each LOD. Maximum visibility distance of each LOD is equal to the minimum visibility distance of the next LOD. Maximum visibility distance of the last LOD is equal to inf.
Animation and Morph Targets
You can import skeletal animations and morph targets from an FBX file.
To import animations from an FBX container:
Enable the Import Animations option.
Specify the number of frames per second for imported animation in the Animation FPS field.
To import morph targets just enable the Import Morph Targets option. Morph targets will be imported as child nodes.
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.
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:
- Directional lights are converted into world light sources.
- Point lights are converted into omni light sources.
- Spot lights are converted into projected light sources.
The following parameters of lights are automatically imported into Unigine, so there is no need to set them up twice:
- Light color
- Light radius and attenuation
- Light source position and orientation
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:
- Orthographic (with Z near and far clipping planes support)
- Perspective (with FOV support)
To view the scene through the imported camera choose its name in the drop-down list in the top left corner of the Scene Viewport window.
Adding Imported FBX Asset to the World
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.
If you double-click the imported FBX asset in the Asset Browser, the .mesh and .node files generated in run-time and stored in the FBX container will be displayed: