wiki:Importer

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.

The Model importer only support Collada 1.4 files, 1.5 is not supported.

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.

Example hierarchy

  • LOD0 (all meshes outside any LOD group are considered as LOD0)
    • mesh
    • mesh
    • mesh
  • LOD1
    • mesh
    • mesh
  • LOD2
    • mesh
    • mesh
  • LOD3
    • mesh

To control LOD switching there are two parameters in objdef: lod_curve and lod_curve1, with default values 850 and 300, respectively. These values approximately tell the radius or half-size of the object on the screen (in pixels) for LOD0 or LOD1 level rendering. In other words, lod_curve1 is the screen size you want the object to be when switching to LOD1. lod_curve corresponds to the screen size of the object for which it was created, where it looks best; any bigger than that (camera closer) and geometry and textures are stretching.

Other levels are derived from these two numbers. The screen size for k-th LOD level is computed as:

lod_curve1k / lod_curvek-1

This is useful when you want to know what screen size the other LODs should be designed for.

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, which script is used 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.

Distributing the imported models

When you import your model, a folder under packages/yourname/ in OT data dir is created. You will probably have to edit several of the generated files there.

Once the model is ready, you should create a thumbnail image for it, giving it the same name as the objdef, but with the gif extension. The thumbnail file should be a gif image in resolution 64x36.

To package the model, please go to the object window, select the model and press export. You will be asked to select the destination folder where the Outerra model file will be written. The file will be in the format package.nickname.otx

The otx file contains your zipped model with all the necessary files. Anteworld registers itself as a handler of otx files, so other users just have to click on the file and let it be installed by Anteworld automatically.

Last modified 3 years ago Last modified on Nov 21, 2014, 5:05:17 PM