Try the Samples#

The best way to learn about OpenUSD Exchange functionality is to try out the OpenUSD Exchange Samples. These are simple applications that showcase many features and key concepts of the SDK.

You can execute the samples to try them out, learn from their source code, and modify them to experiment with OpenUSD and the OpenUSD Exchange SDK for yourself.

Get the Samples#

The OpenUSD Exchange Samples are available on GitHub. You can clone the repository or download the source as a zip file.

The Samples README provides detailed descriptions and documentation about the individual samples.

Each sample provides equivalent C++ and Python implementations. Before they can be used, you must first build the Samples.

Build the Samples#

To try the Samples you will need to build them from source. The included build scripts make it easy.

This project builds with CMake and requires “make” and “g++”. The build script fetches a pinned CMake automatically (or uses a system cmake if one is present).

  1. Open a terminal.

  2. To obtain “make” type sudo apt install make (Ubuntu/Debian), or yum install make (CentOS/RHEL).

  3. For “g++” type sudo apt install g++ (Ubuntu/Debian), or yum install gcc-c++ (CentOS/RHEL).

  4. Use the provided build script to assemble the OpenUSD Exchange SDK & OpenUSD runtime (via install_usdex) and compile the C++ samples:

    ./build.sh
    

    For debug builds, use ./build.sh --debug

This project requires Microsoft Visual Studio 2022 or newer. The build script fetches CMake automatically, so Visual Studio is the only manual install.

  1. Download & install Visual Studio with C++.

  2. Use the provided build script to assemble the OpenUSD Exchange SDK & OpenUSD runtime (via install_usdex) and compile the C++ samples:

.\build.bat

For debug builds, use .\build.bat --debug

Run the C++ Samples#

Once you have built the samples, you can run their executables to try them. All of the compiled samples are executed with a run script with the program name as the first argument. There are many samples under the source folder, like createStage, createLights, createTransforms, etc.

Use the run.sh script (e.g. ./run.sh createStage) to execute each program with a pre-configured environment.

For command line argument help, use --help

./run.sh createStage --help

Use the run.bat script (e.g. .\run.bat createStage) to execute each program with a pre-configured environment.

For command line argument help, use --help

.\run.bat createStage --help

Run the Python Samples#

Setup and activate a virtual environment for USD Exchange as suggested in Getting Started. Run the samples within the virtual environment:

For command line argument help, use --help

python source/python/createStage.py

For command line argument help, use --help

python source\python\createStage.py

Experiment#

Once you have oriented yourself with the samples that interest you, try modifying the source code in the source/ directory of the repository to experiment with the SDK. Once you’ve made your change, just repeat the Build and Run steps in this guide and test out your change.

When you’re ready, see Create a Native Application to learn how to start building your own application or simply continue using the Python wheels in your own scripts & modules.