Home

Awesome

Connect Samples for the Omniverse Connect SDK

These samples demonstrate some key concepts for writing Omniverse Connectors and Converters. The samples use the OpenUSD and Omniverse Connect SDK to demonstrate how to author consistent and correct USD:

How to Build

Build and CI/CD Tools

The Samples repository uses the Repo Tools Framework (repo_man) to configure premake, packman, build and runtime dependencies, testing, formatting, and other tools. Packman is used as a dependency manager for packages like OpenUSD, the Omniverse Client Library, the Omniverse USD Resolver, the Omniverse Asset Validator, and other items. The Samples use the Connect SDK's standard repoman and packman tooling as templates for including and linking against USD, Omniverse Client, etc. These can serve as an example for the build and runtime configuration that a customer's application might require. Here's a list of interesting files:

For details on choosing and installing Connect SDK build flavors, features, or versions, see the install_sdk tool documentation.

Linux

This project requires "make" and "g++".

Use the provided build script to download all other dependencies (e.g USD), create the Makefiles, and compile the code.

./repo.sh build

Use any of the run_*.sh scripts (e.g. ./run_hello_world.sh) to execute each program with a pre-configured environment.

Tip: If you prefer to manage the environment yourself, add <samplesRoot>/_build/linux64-x86_64/release to your LD_LIBRARY_PATH.

For commandline argument help, use --help

./run_hello_world.sh --help

Windows

Building

Use the provided build script to download all dependencies (e.g USD), create the projects, and compile the code.

.\repo.bat build

Use any of the run_*.bat scripts (e.g. .\run_hello_world.bat) to execute each program with a pre-configured environment.

For commandline argument help, use --help

.\run_hello_world.bat --help

Building within the Visual Studio IDE

To build within the VS IDE, open _compiler\vs2019\Samples.sln in Visual Studio 2019. The sample C++ code can then be tweaked, debugged, rebuilt, etc. from there.

Note : If the Launcher installs the Connect Samples into the %LOCALAPPDATA% folder, Visual Studio will not "Build" properly when changes are made because there is something wrong with picking up source changes. Do one of these things to address the issue:

Changing the MSVC Compiler [Advanced]

When repo.bat build is run, a version of the Microsoft Visual Studio Compiler and the Windows 10 SDK are downloaded and referenced by the generated Visual Studio projects. If a user wants the projects to use an installed version of Visual Studio 2019 then run repo.bat build --use-devenv. Note, the build scripts are configured to tell premake to generate VS 2019 project files. Some plumbing is required to support other Visual Studio versions.

Using the Connect SDK in an Application

See the Connect SDK Getting Started docs for a walkthrough of how use the Connect SDK and Open USD in your application.

Sample Details

The samples listed are focused on these key concepts:

Omni Asset Validator

A command line USD validation tool (omni_asset_validator.bat|sh).

The Omniverse Asset Validator is a Python framework to provide Usd.Stage validation based on the USD ComplianceChecker (i.e. the same backend as the usdchecker commandline tool), with an aim to validate assets against Omniverse specific rules to ensure they run smoothly across all Omniverse products.

Complete Asset Validator Documentation

To get the supported command line arguments, run omni_asset_validator.bat|sh --help. For example, the --fix flag will automatically apply fixes to a stage if possible (not all validation failures are automatically repairable):

omni_asset_validator.bat|sh --fix omniverse://localhost/Users/test/helloworld.usd

The asset validator may also be run against stages in-memory. This is demonstrated in the Python version of the LiveSession example with the v option.

Omni CLI

A command line utility to manage files on a Nucleus Server (omnicli.bat|sh).

This program was initially created to exercise most of the Omniverse Client Library API, but has grown to be a useful utility to interact with Nucleus servers. Typing help will produce a menu that shows the many functions available. Among the most useful are the move/copy functions which can transfer data to and from servers.

HelloWorld (C++ and Python)

A sample program that creates a USD stage on a Nucleus server (run_hello_world.bat|sh or run_py_hello_world.bat|sh).

The sample demonstrates how to:

LiveSession (C++ and Python)

A sample program that demonstrates how to create, join, merge, and participate in live sessions (run_live_session.bat|sh or run_py_live_session.bat|sh).

A .live layer is used in the stage's session layer to contain the changes. An Omniverse channel is used to broadcast users and merge notifications to all clients, and a session config (TOML) file is used to determine the "owner" of the session.

The sample demonstrates how to:

OmniUSDAWatcher (C++)

The Omniverse USDA Watcher is a command line program that keeps an updated USDA file on local disk that maps to a Live USD layer (.live) resident on a Nucleus server (run_omniUsdaWatcher.bat|sh).

It takes two arguments, the USD layer to watch and the output USDA layer:

Note: Since the version 200.0 releases of the Connect Sample (Client Library 2.x) only .live layers synchronize through Nucleus. This tool will export any supported USD file format as USDA, but if you intend to watch live file edits it must be a .live layer. For more information on where to find the root.live layer for Live Sessions, see the Connect SDK Live Session Configuration File Utilities.

The "watcher" demonstrates how to:

For example, to monitor the stage that the HelloWorld sample creates by default in "live" mode:

run_omniUsdaWatcher.bat|sh omniverse://localhost/Users/test/helloworld.live C:\USD\helloworld.usda

OmniSimpleSensor (C++)

The Omniverse Simple Sensor example demonstrates how to connect external input (e.g sensor data) to a USD layer in Nucleus(run_omniSimpleSensor.bat|sh).

This could effectively be a large number of inputs that report current values for IoT sensors or could be locations from robots and a real-time synchronization of the data in the virtual world is desired.

It takes three arguments, the Nucleus server path, the number of inputs and a timeout value.

run_omniSimpleSensor.bat|sh  <server path> <number of inputs> <timeout>

For example, run_omniSimpleSensor.bat omniverse://localhost/Users/test 27 -1

There are two parts to this project.

OmniSimpleSensor will build a USD with a number of boxes (meshes) on one layer.

OmniSensorThread is then started for each 'input' specified in the command line.

For example, if 6 inputs are specified then there will be 6 OmniSensorThread processes running, independently of each other. The OmniSensorThread will launch a thread that will update the color of its assigned box at a given frequency (300ms in the code, but this can be altered). When opening the SimpleSensorExample.live stage in USD Composer the boxes will change colors at regular intervals.

This project can easily be extended to change the transform of the boxes or to add some metadata with a custom string attached to the USD or do change visibility states.

Some things to note here:

Issues with Self-Signed Certs

If the scripts from the Connect Sample fail due to self-signed cert issues, a possible workaround would be to do this:

Install python-certifi-win32 which allows the windows certificate store to be used for TLS/SSL requests:

tools\packman\python.bat -m pip install python-certifi-win32 --trusted-host pypi.org --trusted-host files.pythonhosted.org

External Support

First search the existing GitHub Issues and the Connect Samples Forum to see if anyone has reported something similar.

If not, create a new GitHub Issue or forum topic explaining your bug or feature request.

Whether adding details to an existing issue or creating a new one, please let us know what companies are impacted.

Licenses

The license for the samples is located in LICENSE.md.

Third party license notices for dependencies used by the samples are located in the Connect SDK License Notices.

Documentation and learning resources for USD and Omniverse

OpenUSD Docs - Creating Your First USD Stage

OpenUSD API Docs

OpenUSD User Docs

OpenUSD Tutorials and Examples

OpenUSD Code Samples

NVIDIA OpenUSD Docs

Omniverse Connect SDK Docs

Omniverse Client Library Docs

Omniverse USD Resolver Docs