3D Models: Difference between revisions

From Maria GDK Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
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.  
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 [http://codedocs.maria.teleplanglobe.com/release/managed/interface_t_p_g_1_1_geo_framework_1_1_native_layer_bridge3_d_1_1_contracts_1_1_i_native3_d_rendering_manager.html 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.
In order to use a model it needs to be registered in the [http://codedocs.maria.teleplanglobe.com/release/managed/interface_t_p_g_1_1_geo_framework_1_1_native_layer_bridge3_d_1_1_contracts_1_1_i_native3_d_rendering_manager.html 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 <code>model.cfg</code> or <code>model.json</code>. The JSON format is preferred and new models should only use this
 
<source lang="json">
 
{
    "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"
        }
    ]
}
</source>
 
 
=== Material files ====
 


    
    

Revision as of 15:29, 2 August 2024

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