3D Models

From Maria GDK Wiki
Revision as of 15:29, 2 August 2024 by Ths (talk | contribs)
Jump to navigation Jump to search

3D models of various standard formats can be used in Maria 3D. Models can be used in various parts of the system, but the most common is to add a 3D model to a point object, such as a track or a point symbol.

In order to use a model it needs to be registered in the INative3DRenderingManager. Models are referenced by a string ID which can be set explicitly with AddModel, or it will be defined in the model config file.

When using the AddModelDirectory method all models with a corresponding model config file will be added.

=== Model config files

A 3D model can have an associated model config file. There are two formats for this file which will be found as model.cfg or model.json. The JSON format is preferred and new models should only use this

{
    "id": "pawn",
    "file": "pawn.fbx",

    "rotate": [ -90.0, 0.0, 0.0 ],
    "translate": [ 0.0, 0.0, 0.0 ],
    "scale": 1.0,

    "variants":
    [
         {
            "id": "pawn_blue",
            "material": "blue.mtl"
        },
        {
            "id": "pawn_red",
            "material": "red.mtl"
        },
        {
            "id": "pawn_green",
            "material": "green.mtl"
        },
        {
            "id": "pawn_yellow",
            "material": "yellow.mtl"
        }
    ]
}


=== Material files




Supported formats

In theory we support all formats that are supported by the assimp asset loading library, but in practice there are only a few formats that are generally well behaved. We have had most success with the following formats:

  • Autodesk FBX (.fbx)
  • Collada (.dae)
  • Wavefront OBJ (.obj)
  • Lightwave (.lwo)

Model config files