3D Models Requirements
This article describes the recommended methods of importing 3D geometry (3D models) to UNIGINE by means of UnigineEditor.
Geometry
The FBX file format is recommended for working with 3D geometry. Export to .fbx is supported by the most popular 3D editors: Autodesk Maya, Autodesk 3ds Max, Blender, Modo, etc.
After importing the .fbx file into UNIGINE a so-called runtime file is generated in an internal MESH file format for the source file. The created .mesh file is saved to the data/.runtimes folder that is created in the same directory as the source .fbx file in the data root folder.
In terms of UnigineEditor, the imported file becomes an Asset, a "unit of work" that is useful in world building. After adding to the virtual world, geometry of the asset (same as any object in the scene) becomes the node and can be seen in the World Hierarchy window. Any material, assigned to this geometry, becomes the single surface of this node (surfaces can be found in the Surfaces section on the Node tab of the Parameters window). The maximum number of vertices per surface:
- 4294967295 for ObjectMeshStatic.
- 65535 for ObjectMeshDynamic.
- 4294967295 for ObjectMeshSkinned.
For example, in the 3D editor we have the car model consisting of five parts (the frame and four wheels). Two materials (car paint and glass) are assigned to the frame, one material (rubber) is assigned to each wheel. After exporting the model to .fbx and then importing to UNIGINE, five .mesh files will be created (according to the amount of car parts in the 3D editor):
- Each of the four wheels will have one surface, as one material has been assigned.
- The frame will have two surfaces (as two materials have been assigned).
- The names of the surfaces will correspond to the names of materials, assigned in the 3D editor.
- UNIGINE materials will be created automatically on the .fbx file import; their names will also correspond to the names of the 3D editor materials.
Texture Coordinates
UNIGINE supports two UV channels for geometry. To specify whether to use 1st or 2nd channel use materials settings. For example, you can use the 1st channel for tiling, and the 2nd channel for the light map.
Level of Details
If you want to create several variations of one object with different levels of detail (LOD), it is recommended to create them as separate surfaces. This will allow you to reduce the amount of nodes in the hierarchy and simplify the settings of the LODs visibility. The amount of polygons in the neighbouring LODs should differ at least 2-3 times. The recommended amount of LODs is 2 or 3 (more LODs will cause big CPU load).
To import LODs (different objects) to UNIGINE as different surfaces of one node, choose the Merge static meshes option on FBX import.
Textures
UNIGINE supports the most popular bitmap texture formats: .png, .jpg, .tiff, .dds, .tga, .rgb, .rgba, .psd, .hdr, .pgm, .ppm, .sgi with support for:
- 8, 16 and 32 bit precision per channel
- Alpha channel
- Baked MIP-levels
You can import texture of any type listed above: the runtime .dds file will be generated (if necessary) automatically.
Texture resolution should be power of two, for example: 128×128, 256×256, 512×512, 1024×1024, 2048×2048, etc. Both square and rectangular textures are supported (for example, 256×1024 pixels).
Texture resolution should not exceed 4096×4096.
The texture postfix is important as it defines the compression algorithms and used color channels. The examples of postfixes:
- texture_alb for albedo textures.
- texture_d for diffuse textures.
- texture_n for normal textures.
- texture_nrgb for normal textures that store an alpha value in the B channel.
- texture_s for specular textures.
- texture_sh for shading textures (R - metalness, G - roughness, B - specular, A - microfiber).
- texture_a for ambient occlusion textures.
- texture_h for height maps (parallax effect).
- texture_l for light maps.
- texture_e for emission textures.
Animation
UNIGINE supports skinned mesh animation (3D model vertices have corresponding bones and their weights). The animated 3D model can be stored in two ways:
- In a single .mesh file containing both geometry and animation. This variant is usually used for simple objects (for example, lift doors).
- In separate files: .mesh (containing only geometry) and .anim (containing bones and their weights). Separate files are usually used for complex objects with a number of animation (for example, characters).
To export animation to .fbx from 3D editor choose Animation and Bake Animation and specify which frames should be exported. When importing the animated .fbx file to UNIGINE, separate .mesh (containing geometry) and .anim (containing animation) files will be created.
Maximum amount of bones per surface — 128. Maximum amount of weights per vertex — 4.
Names
For file and surface names it is recommended to use English, low case, without spaces.