Share

USD for MotionBuilder

USD Overview

This release of MotionBuilder introduces support for loading, displaying and interacting with static OpenUSD Stages. You can now load a USD Stage into the viewport and animate it in context without having to import large scenes. You can also interact with the stage via Python.

  • You are now able to load an OpenUSD stage and display it, together with the MotionBuilder data.
  • Basic manipulation of the stage node is now available.
  • MotionBuilder supports and displays both textures and lights from USD data.
  • The OpenUSD API is available for accessing the stage objects through scripting.

USD Workflows

Loading a Stage

  • Loading a USD stage creates a "Usd Stage" node, which connects USD and MotionBuilder data.
  • To load a stage, "Window > Usd Stage Manager", then create a stage node and add a path to it.
  • A USD Stage Node can also be created from the Asset Browser under the "Elements" tab. Note that you will still need to specify a file path to your USD Stage.

USD Stage Manager

  • This window manages the stage nodes present in your scene. You can select or update your stage path here. You can also load multiple stages.

  • Create Stage - this adds a stage node to your scene. The Stage node connects MotionBuilder and the USD file. Use the drop down menu to select a node when multiple stage nodes are present.
  • File Path - this is the path to your desired OpenUSD file/Stage.
  • The stage path can be changed at any time. Note that changing the stage path loads the new file and removes the previous file. To add more than one file, simply create a new USD Stage node.
  • Loading a stage does not automatically display the USD data in the viewport. Enable the USD renderer to view it.

Render USD data

  • OpenUSD data needs to be rendered through the USD renderer in order for it to be displayed in Viewer. To enable the USD renderer, select "Renderer > USD"

Modifying USD Stage Node

  • A USD Stage node is treated as a simple transform in MotionBuilder. You can perform basic operations such as move, rotate, scale and simple animations. Note that such operations are applied to the entire stage.
  • A USD Stage is represented as a MotionBuilder node. You can modify the USD Stage using the Property View.

Python API samples

  • You can use Python scripts to load a stage and access its content.
    • The Example below shows how to load a USD stage file, activate the USD Renderer and access the loaded USD content through the USD API.
from pyfbusd import *
from pxr import Usd, UsdGeom

# Create the USD Stage, specify its path and show it
myUsdStage = FBUsdStageProxy( "myUsdStage" )
myUsdStage.FilePath = r"C:\temp\UsdStage.usd"
myUsdStage.Show = True

# Activate the USD Renderer
lScene = FBSystem().Scene
lRenderer = lScene.Renderer

i = 0
for renderCallback in lRenderer.RendererCallbacks:
    if renderCallback.Name == 'USD Renderer':
        lRenderer.CurrentPaneCallbackIndex = i
        break
    i = i + 1

# Access the USD Stage via the USD API
stage = Usd.Stage.Open(myUsdStage.FilePath)
defaultPrim = stage.GetDefaultPrim()
geomX = UsdGeom.Xformable(defaultPrim)

# Apply a Y translation to the stage
if len(geomX.GetOrderedXformOps()) == 0:
    geomX.AddTranslateOp().Set(Gf.Vec3d(0.0, 0.0, 0.0))

xformOps = geomX.GetOrderedXformOps()
xformOps[0].Set( Gf.Vec3d(0.0, 300.0, 0.0))
  • You can also use Python scripts to create a stage and its prims.
    • The Example below shows a sample script that creates a USD stage files and adds a simple sphere node through the USD API.
    • The resulting file on this case, is saved under "C:\temp".
from pxr import Usd, UsdGeom

# Create a stage 
stage = Usd.Stage.CreateNew('C:/temp/sphere.usda')

# Create an XForm node called "Root"
UsdGeom.Xform.Define(stage, '/Root')

# Create a USD sphere geometry under the Root Xform
UsdGeom.Sphere.Define(stage, '/Root/pixar_sphere')

# Save the data to the stage
stage.GetRootLayer().Save()

Known Issues/Limitations:

Import/Export

  • The conversion of OpenUSD data into MotionBuilder data is not currently supported.

Textures

  • USD stages only load in the full textured mode.
  • There is no support for MaterialX.

Duplicate stages

  • Duplicating a USD stage creates a reference to the same stage, which may lead to undesirable outcomes.

Performance

  • MotionBuilder loads a stage in full textured mode, and with all available payloads loaded.
  • Opening a large and complex stage may cause crashes or low performance. It is recommended to adjust the stage settings/objects visibility for large and complex stages prior to loading them into MotionBuilder.

Compatibility

  • Compatibility with different OpenUSD data structures is not supported for all stages at this point.

Was this information helpful?