Utilities » Scene conversion utility new in 2020.06

Converts scenes of different formats.

This utility is built if both WITH_TRADE and WITH_SCENECONVERTER is enabled when building Magnum. To use this utility with CMake, you need to request the sceneconverter component of the Magnum package and use the Magnum::sceneconverter target for example in a custom command:

find_package(Magnum REQUIRED imageconverter)

add_custom_command(OUTPUT ... COMMAND Magnum::sceneconverter ...)

See Downloading and building, Usage with CMake and the Trade namespace for more information.


magnum-sceneconverter [-h|--help] [-I|--importer IMPORTER]
    [-I|--converter CONVERTER]... [--plugin-dir DIR] [--remove-duplicates]
    [--remove-duplicates-fuzzy EPSILON]
    [-i|--importer-options key=val,key2=val2,…]
    [-c|--converter-options key=val,key2=val2,…]... [--mesh MESH]
    [--level LEVEL] [--info] [--bounds] [-v|--verbose] [--profile]
    [--] input output


  • input — input file
  • output — output file; ignored if --info is present
  • -h, --help — display this help message and exit
  • -I, --importer IMPORTER — scene importer plugin (default: AnySceneImporter)
  • -C, --converter CONVERTER — scene converter plugin(s)
  • --plugin-dir DIR — override base plugin dir
  • --only-attributes "i j …" — include only attributes of given IDs in the output
  • --remove-duplicates — remove duplicate vertices using MeshTools::removeDuplicates(const Trade::MeshData&) after import
  • --remove-duplicates-fuzzy EPSILON — remove duplicate vertices using MeshTools::removeDuplicatesFuzzy(const Trade::MeshData&, Float, Double) after import
  • -i, --importer-options key=val,key2=val2,… — configuration options to pass to the importer
  • -c, --converter-options key=val,key2=val2,… — configuration options to pass to the converter(s)
  • --mesh MESH — mesh to import (default: 0)
  • --level LEVEL — mesh level to import (default: 0)
  • --info — print info about the input file and exit
  • --bounds — show bounds of known attributes in --info output
  • -v, --verbose — verbose output from importer and converter plugins
  • --profile — measure import and conversion time

If --info is given, the utility will print information about all lights, materials, meshes, images and textures present in the file.

The -i / --importer-options and -c / --converter-options arguments accept a comma-separated list of key/value pairs to set in the importer / converter plugin configuration. If the = character is omitted, it's equivalent to saying key=true; configuration subgroups are delimited with /.

It's possible to specify the -C / --converter option (and correspondingly also -c / --converter-options) multiple times in order to chain more converters together. All converters in the chain have to support the Trade::SceneConverterFeature::ConvertMesh feature, the last converter either Trade::SceneConverterFeature::ConvertMesh or Trade::SceneConverterFeature::ConvertMeshToFile. If the last converter doesn't support conversion to a file, AnySceneConverter is used to save its output; if no -C / --converter is specified, AnySceneConverter is used.

Example usage

Printing info about all meshes in a glTF file:

magnum-sceneconverter --info scene.gltf

Converting an OBJ file to a PLY, using StanfordSceneConverter picked by AnySceneConverter:

magnum-sceneconverter chair.obj chair.ply

Processing an OBJ file with MeshOptimizerSceneConverter, setting plugin-specific configuration options to reduce the index count to half, saving as a PLY, with verbose output showing the processing stats:

magnum-sceneconverter chair.obj --converter MeshOptimizerSceneConverter -c simplify=true,simplifyTargetIndexCountThreshold=0.5 chair.ply -v