Asset Converter

Asset Converter is extension that works for providing python interfaces for converting other formats into USD, and also supporting to convert USD to those assets.

Programming Guide

"""
This is the simple sample that utilizes omni.kit.asset_converter to convert assets.
"""

import asyncio
import omni.kit.asset_converter

def progress_callback(current_step: int, total: int):
    # Show progress
    print(f"{current_step} of {total}")

async def convert(input_asset_path, output_asset_path):
    task_manager = converter.get_instance()
    task = task_manager.create_converter_task(input_asset_path, output_asset_path, progress_callback)
    success = await task.wait_until_finished()
    if not success:
        detailed_status_code = task.get_status()
        detailed_status_error_string = task.get_error_message()
        ...

...
asyncio.ensure_future(convert(input_path, output_path))
...

create_converter_task supports a fourth param omni.kit.asset_converter.AssetConverterContext, which you can use to customize the import/export. By default, it will import/export all supported props. Following is its definition:

class AssetConverterContext:
    ignore_materials = False    # Don't import/export materials
    ignore_animations = False   # Don't import/export animations
    ignore_camera = False       # Don't import/export cameras
    ignore_light = False        # Don't import/export lights
    export_preview_surface = False      # Imports material as UsdPreviewSurface instead of MDL for USD export
    use_meter_as_world_unit = False     # Sets world units to meters, this will also scale asset if it's centimeters model.
    create_world_as_default_root_prim = True    # Creates /World as the root prim for Kit needs.
    embed_textures = True   # Embedding textures into output. This is only enabled for FBX and glTF export.
    convert_fbx_to_y_up = False   # Always use Y-up for fbx import.
    convert_fbx_to_z_up = False   # Always use Z-up for fbx import.
    merge_all_meshes = False      # Merges all meshes to single one if it can.
    use_double_precision_to_usd_transform_op = False   # Uses double precision for all transform ops.
    ignore_pivots = False         # Don't export pivots if assets support that.

Features Supported

  • Supports OBJ/FBX/glTF to USD and USD to those formats. Asset converter will fallback into Assimp if the format is not recognized. So all formats that are supported by Assimp should be supported too. But only OBJ/FBX/glTF are mainly supported and tested.

  • Supports both glTF (text) and glb (binary) with/without embedding textures.

  • Supports meshes/cameras/lights import.

  • Supports rigid and skeletal animations.

  • Supports to convert glTF materials into MDL with extensions KHR_materials_pbrSpecularGlossiness, KHR_materials_clearcoat, KHR_draco_mesh_compression, KHR_texture_transform, KHR_materials_volume, KHR_materials_emissive_strength, KHR_materials_ior, KHR_materials_sheen, KHR_materials_transmission.

Limitations

  • It does not support recursive skeleton for glTF.

  • Only OmniPBR, UsdPreviewSurface, and specified gltf.mdl are supported for exporting USD to other formats. It does not support to bake any MDLs into other material surfaces.