Customize the 3D environment#

Import external 3D meshes#

It is possible to enrich the 3D environment, when launching the unreal application, by adding new meshes to it. New 3D meshes can be loaded from the configuration file passed to the application using the command line option -config-file.

A configuration file could look like this:

Meshes:
  - Name: 'MyAwesomeMesh'
    FbxPath: "/path/to/MyAwesomeMesh.fbx"
    Location: "100 200 300"
    Rotation: "0 0 45"
    Scale: "1 1 1"
    SnapToGround: true
  - Name: 'MyEvenMoreAwesomeMesh'
    FbxPath: "/path/to/MyEvenMoreAwesomeMesh.fbx"
    Location: "0 0 500"
    SnapToGround: false

As shown in the example above, all mesh definitions belong to the same dictionary entry Meshes. Each mesh definition must have the following fields:

  • Name - The name of the object to be created.

  • FbxPath - The absolute path of the .fbx file to be loaded.

  • Location - (optional) The world location of the new object, expressed in the Unreal Engine’s coordinate system. Default value is (0 0 0).

  • Rotation - (optional) The absolute rotation of the new object, expressed in the Unreal Engine’s coordinate system.

    Default value is (0 0 0).

  • Scale - (optional) The scale multiplier of the new object. This option does not define the real size of the mesh. It is a multiplier of the actual mesh size defined in the .fbx.

    For example, of your mesh has a size of (2m, 4m, 7m) a scale of (2, 0.5, 1) will create a mesh with a size of (4m, 2m, 7m).

    Default value is (1 1 1).

  • SnapToGround - (optional) A boolean parameter that defines whether the new object would be floating or not. If it is true, the mesh will be placed on the first encountered obstacle under itself. Default value is false.

_images/imported_eiffel_tower.jpg

Preparing the mesh#

To better prepare the mesh, some points need to be clarified.

  • Only .fbx files are supported by this feature. Other formats like .obj, .gLTF, .dae, .stl, .3ds are not supported.

  • Each .fbx file is loaded as one object in the unreal application even if the .fbx contains multiple meshes.

  • The mesh scale applied in the 3D editor is applied to the mesh itself when being loaded.

  • Materials can be loaded with the mesh if any.

  • Only 4 material parameters are supported:
    • Metallic: float with the metalness value.

    • Roughness: float with the roughness value.

    • Specular: float with the specular value.

    • Base color: Can be a vector containing the RGBA color or a 2D texture.

  • In case a texture is used, make sure that it is saved on the computer not within the 3d engine. Textures must have valid absolute path to be loaded.

  • When exporting the .fbx file, make sure to select the correct forward/up vectors that matches Unreal Engine’s coordinate system.

    Note

    A hint for blender users: forward vector should be set to -Y and up vector should be set to -Z to match the Unreal Engine’s coordinate system.