для этой страницы,
отображается код на другом
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:
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.|
|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.|
|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.
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.
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.
|Import Morph Targets||Enables importing morph targets from the file.|
|Combine by Postfixes||Enables automatic creation of the Levels of Detail (LODs).|
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.
|Workflow||Provides an interface to choose a workflow for the imported physically based materials (if any).
|Add Prefix||Enables to add a prefix for imported materials to avoid collision of names.|
|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.|
|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.|
|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.|
Lightmap UV Creation Options#
|UV Channel||UV channel to store the lightmap.|
|Lightmap Target Resolution||Resolution of the resulting lightmap.|
|UV Padding||Padding value.|
|Packing Quality||The efficiency of UV islands layout on the texture.|
Other Import Options#
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.
When importing geometry keep in mind the limitations set in UNIGINE for the maximum number of vertices per surface. It is 4294967295 for any type of mesh.
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 which 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 Editor 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: