wiki:Importer

Version 1 (modified by cameni, 7 years ago) (diff)

--

Model Importer

Model importer is built-in into the engine, it can be invoked from the "objects" tool by clicking on the "Import ..." button, which brings up the importer window.

Importing is a 3-phase process, each part has its own tab in the importer. The first one is selecting and loading the *.DAE Collada file. This does basic checks before you are allowed to move further. You can assign a new name for the package, the imported package will be under packages/your_nick/package_name directory in your Outerra data path.

The second phase is the configuration. You'll get a list of the loaded objects from the Collada file, and you can select which ones to import as static objects, vehicles or aircraft, and which ones to omit. You can also modify the names of objects as they should be known in the program or script internally. Note that configuration of vehicles and aircraft is unfinished, but you can test your models as static ones now. When done, the importer will also allow you to configure the physics, by combining physics configuration files and binding it to the hierarchy.

The third phase is the import itself. After that one completes successfully, the package is created and the object is also automatically inserted into the scene in front of you. If you had multiple objects in the package, you'd be able to switch between them there. If there are errors, you will see them highlighted in the log.

The whole process can be freely repeated, you can modify the external files and have it reimported to see the changes. The ultimate goal is to be able to perform lots of final tweaking directly in the engine, like adjusting the materials, physics etc.

Notes:

  • Root nodes of hierarchy are considered standalone objects. If you have the nodes unfolded (i.e. the individual parts show as separate objects), you need to create a root node encompassing the other nodes. You can edit the DAE file directly, adding a new <node name="modelname"> under the <visual_scene> as well as the closing tag </node> before the </visual_scene>
  • Check the units - the importer uses the meter attribute in the unit tag in the Collada file. For example, you can have <unit name="inch" meter="0.0254"/> there. The importer only looks at the value of "meter" attribute, the unit name is ignored
  • You'll often have to fix the paths to the texture files, since in the DAE file they are as absolute paths to your drives. To fix the paths, edit the DAE file and change the paths to the texture files accordingly. You can use relative paths there too.
  • Only the DDS texture files are supported, you have to convert other texture types to DDS manually now via other tools (many image viewers support the conversion). After the conversion you either have to re-export the model again, or edit the DAE file directly, replacing the texture file paths with the correct ones. Additionally, all textures have to be in the right DDS format:
    • diffuse has to be DXT1 format
    • normal map has to be 3Dc/ATI2 format
    • opacity map has to be ATI1 format
    • roughness map has to be ATI1 format
    • material reflectance map has to be ATI1 format
  • Roughness map and material reflectance map allow you to define the whole material in textures so you can have one single mesh and multiple materials and the mesh is still rendered in one draw call. Usually the reflectance is not as important as the roughness, in most case the roughness texture map is enough
  • You can use nvidia texture tools to perform the conversions, later it will be included and done automatically

Every separate object in COLLADA file has to have corresponding root node with object name. In the second hierarchy level you can define LOD levels, these levels are optional but you should use them because they help a lot with performance. Currently we support 4 LODs, these LOD parents names have to start with LOD0.., LOD1..., LOD2..., LOD3..., COLLISION... the last will be used as a collision mesh.

Issues you may encounter with the models and import

  • If the models are low poly at places, you can get artifacts in lighting and shadowing and also depth buffer because of the logarithmic depth buffer. The models need to be tesselated sufficiently, generally do not make triangles with edges longer than 0.5m.
  • Do not use the default 3DS Max COLLADA export, use the OpenCOLLADA plugin instead.
  • Double-sided materials aren't supported
  • The importer will only import the basic materials, it cannot recognize special ones, but you'll be able to edit the matlib file after the import

The importer generates a couple of files:
pkg - contains the geometry of the whole package, with one or more objects
matlib - material library, defines the materials for the model
objdef - definition of individual objects - which materials are used, later will contain definitions for the physics
impcfg - input configuration file, not a part of the package, but defines how the model is imported, what bones are exposed etc.