SimReady Explorer Developer Guide

Overview

SimReady Assets are the building blocks of industrial virtual worlds. They are built on top of the Universal Scene Description (USD) platform and have accurate physical properties, behaviors, and connected data streams. They are comprised on multiple files such as USD layers, material description files (.mdl), textures, thumbnails, etc.

The SimReady Explorer extension allows for working with libraries of SimReady Assets, by enabling users to:

  • Find assets by words matched against tags and asset names

  • Configure asset behavior, appearance, etc in the browser, before they are assembled into a scene

  • Assemble assets into virtual worlds through Omniverse applications such as USD Composer, DriveSim, Isaac Sim, etc.

Through the SimReady Explorer API, developers can:

  • Search for assets by matching search words against tags and asset names

  • Configure various aspects of assets, as defined by the asset class

  • Add the configured assets to a stage

Finding assets

SimReady Assets have a name, tags, and labels. The labels are derived from the Wiki Data database, and as such are backed by QCodes. Note that the labels and the QCode of an asset are also part of its list of tags. Both tags and labels can consist of multiple, space separated words.

Finding SimReady Assets is like querying a database. A list of search terms is each matched against the asset’s name and tags. Partial matches of the search term in names, tags, and labels are also returned. For example, the search term “wood” would match names such as “recycledwoodpallete” and “crestwood_sofa”.

See the find_assets() API for details on how to programmatically search for assets.

Configuring assets and adding them to a stage

The find_assets() API returns a list of SimreadyAsset objects, which can be added to the current stage with the desired behaviors enabled. The behaviors supported currently are the USD variant sets exposed by the asset. When adding assets to a stage, they can be inserted at a given location, can be parented to another prim, or can be added at or even replace a list of prims.

See the add_asset_to_stage(), and the add_asset_to_stage_using_prims() APIs for details on how to programmatically add assets to the current stage.

SimReady Explorer API Tutorial

The following code illustrates how to find assets, add them to the current scene, and even replace some of them with other assets. The code below can be executed from the Script Editor of any Omniverse application.

import asyncio
from typing import List, Tuple

import omni.kit.app
import omni.simready.explorer as sre
import omni.usd
from pxr import Gf, Sdf, Usd


async def main():
    # 1. Find all residential wooden chair assets.
    # We use multiple search terms, some will be matched in the tags, others in the asset names
    assets = await sre.find_assets(search_words=["residential", "chair", "wood"])
    print(f"Found {len(assets)} chairs")

    # 2. Prepare to configure the assets
    # All SimReady Assets have a Physics behavior, which is implemented as a
    # variantset named PhysicsVariant. To enable rigid body physics on an asset,
    # this variantset needs to be set to "RigidBody".
    variants = {"PhysicsVariant": "RigidBody"}

    # 3. Add all assets found in step (1) to the current stage as a payload
    added_prim_paths: List[Sdf.Path] = []
    for i, asset in enumerate(assets):
        pos = -200 + 200 * i
        res, prim_path = sre.add_asset_to_stage(
            asset.main_url, position=Gf.Vec3d(pos, 0, -pos), variants=variants, payload=True
        )
        if res:
            print(f"Added '{prim_path}' from '{asset.main_url}'")

    # 4. Find an ottoman
    assets = await sre.find_assets(search_words=["ottoman"])
    print(f"Found {len(assets)} ottomans")

    # 5. Replace the first chair with an ottoman
    if assets and added_prim_paths:
        usd_context: omni.usd.UsdContext = omni.usd.get_context()
        stage: Usd.Stage = usd_context.get_stage() if usd_context else None
        await omni.kit.app.get_app().next_update_async()
        res, prim_path = sre.add_asset_to_stage_using_prims(
            usd_context,
            stage,
            assets[0].main_url,
            variants=variants,
            replace_prims=True,
            prim_paths=[added_prim_paths[0]],
        )
        if res:
            print(f"Replaced assets '{added_prim_paths[0]}' with '{prim_path}' from '{assets[0].main_url}'")


asyncio.ensure_future(main())

Future enhancements

The SimReady Explorer API will be extended in the near future to allow defining custom asset classes with specific behaviors.