From 700da7c5bd0e963a7f572507dc1bd4a0b2962745 Mon Sep 17 00:00:00 2001 From: Sam Haves Date: Thu, 31 Jul 2025 09:29:38 -0700 Subject: [PATCH] Add initial documentation for experimental OpenUSD support in MuJoCo. PiperOrigin-RevId: 789365870 Change-Id: I19cce03ec2ffc28cdf4252bfd02c8b5163bb5ba2 --- doc/OpenUSD/building.rst | 57 +++++++++++++++ doc/OpenUSD/exporting.rst | 15 ++++ doc/OpenUSD/importing.rst | 29 ++++++++ doc/OpenUSD/index.rst | 63 ++++++++++++++++ doc/OpenUSD/mjcPhysics.rst | 97 +++++++++++++++++++++++++ doc/OpenUSD/mjcf_file_format_plugin.rst | 87 ++++++++++++++++++++++ doc/index.rst | 1 + 7 files changed, 349 insertions(+) create mode 100644 doc/OpenUSD/building.rst create mode 100644 doc/OpenUSD/exporting.rst create mode 100644 doc/OpenUSD/importing.rst create mode 100644 doc/OpenUSD/index.rst create mode 100644 doc/OpenUSD/mjcPhysics.rst create mode 100644 doc/OpenUSD/mjcf_file_format_plugin.rst diff --git a/doc/OpenUSD/building.rst b/doc/OpenUSD/building.rst new file mode 100644 index 00000000..f6e1c2ce --- /dev/null +++ b/doc/OpenUSD/building.rst @@ -0,0 +1,57 @@ +Building +======== + +.. WARNING:: OpenUSD support is currently experimental and subject to frequent change. + +Advanced users can start testing out USD support by building against their own USD libraries or USD built from source. + +This assumes that you have built MuJoCo in ``~/mujoco`` and have a build directory at ``~/mujoco/build`` + +Building USD +------------ + +USD has a pretty streamlined installation via their ``build_usd.py`` script. It's recommended to use a separate +installation directory that exists outside of the cloned repository directory. + +.. code-block:: bash + + git clone https://github.com/PixarAnimationStudios/OpenUSD + python OpenUSD/build_scripts/build_usd.py /path/to/my_usd_install_dir + +Enabling USD +------------ + +USD is comprised of many plugins. When USD enabled application starts up it looks for an environment variable called +``PXR_PLUGINPATH_NAME``. Below is an example where we build MuJoCo with USD enabled and set this variable. + +.. code-block:: bash + + cd ~/mujoco/build + cmake .. -DCMAKE_BUILD_TYPE=Release -DUSD_DIR=/path/to/my_usd_install_dir + cmake --build . -j 30; sudo cmake --install . + export PXR_PLUGINPATH_NAME=/usr/local/lib/mujocoUsd/resources/*/plugInfo.json + +If we now run :ref:`simulate.cc `, we will be able to drag and drop USD files. + +.. code-block:: bash + + simulate + +Enabling plugins in Houdini +--------------------------- + +Houdini is a procedural content authoring tool with extensive support for USD workflows via their Solaris context. It's +highly popular in the VFX industry, and it's easy to imagine procedural generation tools for simulation ready assets and +scenes. + +To allow support for loading MJCF files in Solaris, and usage of the mjhcPhysics schemas you can build against Houdini's +USD libraries. To do so, simply run `source ./houdini_setup` as descrived in the `SideFX documentation +`__. + +.. code-block:: bash + + cd ~/mujoco/build + cmake .. -DCMAKE_BUILD_TYPE=Release -DHOUDINI_HFS_DIR=$HFS + cmake --build . -j 30; sudo cmake --install . + export PXR_PLUGINPATH_NAME=/usr/local/lib/mujocoUsd/resources/*/plugInfo.json + houdini diff --git a/doc/OpenUSD/exporting.rst b/doc/OpenUSD/exporting.rst new file mode 100644 index 00000000..212abd5c --- /dev/null +++ b/doc/OpenUSD/exporting.rst @@ -0,0 +1,15 @@ +Exporting +========= + +.. WARNING:: OpenUSD support is currently experimental and subject to frequent change. + +Currently, exporting MuJoCo scenes to OpenUSD format is an area of active development. The primary method for exporting +is expected to be through the Python API. + +USDExporter +----------- + +At the moment the only way to export USD from MuJoCo is to use the existing USDExporter in :doc:`../python`. + +We are working on native support for writing simulations as animations to existing USD scenes, please check back here +for updates. diff --git a/doc/OpenUSD/importing.rst b/doc/OpenUSD/importing.rst new file mode 100644 index 00000000..a0111088 --- /dev/null +++ b/doc/OpenUSD/importing.rst @@ -0,0 +1,29 @@ +Importing +========= + +.. WARNING:: OpenUSD support is currently experimental and subject to frequent change. + +MuJoCo can load assets from OpenUSD files (``.usd``, ``.usda``, ``.usdc``, ``.usdz``). This allows you to incorporate +assets and scenes defined in USD into your MuJoCo simulations. + +USD in MJCF +----------------------------- + +If you have built mujoco with USD enabled, you can reference USD assets from MJCF via the `` + + + + + + ... + + + +In this example the ```` line in ```` tells MuJoCo to load and process the USD file. + diff --git a/doc/OpenUSD/index.rst b/doc/OpenUSD/index.rst new file mode 100644 index 00000000..675bbf6b --- /dev/null +++ b/doc/OpenUSD/index.rst @@ -0,0 +1,63 @@ +OpenUSD +=========== + +.. toctree:: + :hidden: + + building + mjcPhysics + mjcf_file_format_plugin + importing + exporting + +.. WARNING:: OpenUSD support is currently experimental and subject to frequent change. + +Introduction +------------ + +This chapter describes MuJoCo's support for `OpenUSD `__. USD (Universal Scene +Description) is an open-source framework developed by Pixar for describing 3D scenes. MuJoCo's integration allows users +to leverage USD's rich ecosystem and tooling. + +What is OpenUSD? +---------------- + +USD is a high-performance, extensible system for describing, composing, simulating, and collaborating on 3D data. +Originally developed by Pixar Animation Studios, USD is now used across various industries, including visual effects, +animation, gaming, and robotics, to streamline complex 3D workflows. It provides a common language for different +software applications to exchange 3D scene information. + +Why do we care about OpenUSD? +----------------------------- + +Integrating USD with MuJoCo offers several advantages: + +* **Interoperability:** USD is supported by a wide range of 3D content creation tools (e.g., Houdini, Maya, Blender). + This allows MuJoCo users to easily import scenes and assets created in these tools. +* **Rich Scene Description:** USD provides a powerful and flexible way to represent complex scenes, including + geometry, materials, lighting, and hierarchies. +* **Collaboration:** USD's layering and composition features enable powerful and efficient + non-destructive authoring pipelines. + +USD support overview +------------------------------------------------------ + +* **Import:** You can load USD assets (specifically ``.usd``, ``.usda``, ``.usdc``, ``.usdz`` files) into MuJoCo via + MJCF or dragging and dropping into :ref:`simulate.cc `. +* **Schemas:** MuJoCo primarily uses the standard `UsdPhysics + `__ schemas for representing physics properties. +* **Extensions:** Custom :doc:`mjcPhysics` schemas are provided to cover MuJoCo-specific features not available in + ``UsdPhysics``. +* **MJCF File Format Plugin:** A :doc:`mjcf_file_format_plugin` allows treating MJCF files as USD layers in any native USD + application. +* **Export:** MuJoCo scenes can be exported to USD. + +Where do I learn more about USD? +------------------------------------------ + +* `Remedy's Book of USD `__: Friendly introduction to USD. +* `Official OpenUSD Documentation `__: Official documentation for API and + implementation details. +* `Pixar's USD Introduction `__: Simple example usage of USD. +* `NVIDIA's USD Resources `__: Set of USD resources primarily concerned with asset + structure. diff --git a/doc/OpenUSD/mjcPhysics.rst b/doc/OpenUSD/mjcPhysics.rst new file mode 100644 index 00000000..b0f6fb96 --- /dev/null +++ b/doc/OpenUSD/mjcPhysics.rst @@ -0,0 +1,97 @@ +mjcPhysics +========== + +.. WARNING:: OpenUSD support is currently experimental and subject to frequent change. + +The ``mjcPhysics`` `schema `__ allows for detailed +specification of a MuJoCo simulation environment directly within a USD file. The aim is not to replace `UsdPhysics +`__, but to extend existing concepts and create new types +only where is necessary. + +The schema can be use `codeless `__, +or can be built with its C++ bindings. We've pre-generated `the code +`__ via `usdGenSchema +`_ for internal MuJoCo usage, but it should also work +outside of MuJoCo. + +API Schemas +----------- + +MjcSceneAPI +^^^^^^^^^^^ + +This API schema provides global options for the MuJoCo simulation. It is an +amalgamation of the ``