RealityServer Features

Assimp importer

The Open Asset Import Library (assimp) importer supports a wide range of 3D file formats. Including but not limited to FBX, glTF, COLLADA, STL and many more. In particular glTF 2.0 is very well supported including full support for its PBR material model. Other formats offering varying support for materials, lighting and geometry features.

Importer Options

When using the importer through the import_scene, import_scene_elements or import_scene_elements_from_string commands in RealityServer it is possible to provide additional options through the use of the import_options parameter. This parameter accepts a Map where the property key corresponds to the option name and the value to the value you want to set for the option. The table below describes the options available for the Assimp importer. This is in addition to the standard options provided by all importers. These additional options are passed through to the Assimp library directly and allow setting of Assimp configuration options and post process flags. They are not validated, so it is up to the user to ensure the options are valid. Setting properties which Assimp does not recognise will have no affect on the import process.

Assimp Importer Options
Property Key Default Description
config null A map where the property key is the name of an available Assimp configuration option and the value is a map containing two property keys, type which is a string and value which contains the actual value. Supported types are String, Boolean, Sint32, Uint32, Float32, and Float32<4,4>. Other types may work but may lose precision in conversion so using the above types is recommended. These types map to the string, bool, integer, float and aiMatrix4x4 Assimp types internally when being set. The value is expected to be provided in a format that is convertable to the given type. The name of the property key corresponds to the string representing the Assimp configuration variable, not the Assimp variable name. For example to set the value for the AI_CONFIG_PP_PTV_KEEP_HIERARCHY post processing configuration parameter, you need to use the string PP_PTV_KEEP_HIERARCHY. By convention this is generally just a matter of dropping the AI_CONFIG_ prefix from the configuration variable name however for some options you may need to check the Assimp source code.
process_flags null A map where the property key is the name of the available Assimp post-processing flags and the values are a boolean specifying whether to enable the flag or not. The name of the process flag is specified without the aiProcess_ prefix used in the Assimp source code. Assimp offers various post-processing options which can help modify the imported 3D data to be more useful. You should generally only change the default flags if you are familiar with Assimp and how it works. Some of the available flags are also affected by Assimp configuration options which can be set using the config option mentioned above. Refer to the Assimp source code and documentation for full details of the available options. By default the importer enables the GenSmoothNormals, CalcTangentSpace, Triangulate, JoinIdenticalVertices and SortByPType process flags. Note: disabling some process flags may cause importation to fail if the importer is relying on the data being in the structure provided by the flags.
orthographic_aperture_scale 2.0 Assimp internally stores orthographic width as the half width of the view. When used by RealityServer this value is multiplied by this setting to get the full orthographic width. Some formats have ambiguous specifications with respect to how the orthographic width is defined. This option allows you to compensate for this. For example if the format specifies that it uses a half width for orthographic views but most files in the wild have assumed a full width then you can set this option to 1.0 to correct this.

Example: Imports a glTF 2.0 file as a scene and sets various options.

{
    "method": "import_scene",
    "params": {
        "scene_name": "my_scene",
        "filename": "my_file.gltf",
        "import_options": {
            "config": {
                "PP_GSN_MAX_SMOOTHING_ANGLE": {
                    "type": "Float32",
                    "value": 25.0
                }
            },
            "process_flags": {
                "GenSmoothNormals": true
                "JoinIdenticalVertices": false,
                "Triangulate": false
            }
        }
    }
}