ovRTX Clash Sample App#

The ovRTX clash sample app is the developer viewer of standalone ovclash. It renders a USD stage with ovRTX, NVIDIA’s RTX rendering runtime, outside Kit, runs queries through the ovclash Suite and lists their results. It lives in samples/ovrtx_clash_sample_app/.

This page is for maintainers. It covers what the app shows, why it does not ship, how to launch, validate and debug it, where its version pins live, and the implementation rules of its scene backends. The Architecture glossary defines the implementation terms. The sample README, samples/ovrtx_clash_sample_app/README.md, covers the prerequisites (its “Prerequisites” section), the viewer environment (“Viewer environment”), the app’s command line (“App command line”), one-shot runs (“One-shot runs”), the user interface (“Using the viewer”), how a query runs (“Clash queries”), the viewer’s environment variables (“Environment variables”) and a map of the code (“How the code works”).

What it demonstrates#

The app runs the non-Kit clash path on one of two scene backends:

  • ovstage (the default) opens one Stage and inspects and edits it through public stock ovstage APIs. It lends that Stage to ovclash_suite.ClashDetection and to ovRTX. Queries therefore see unsaved edits, and the source file is never opened again. Viewer code imports no Python OpenUSD on this path.

  • openusd is the parity reference. It uses Python OpenUSD (usd-core) for inspection and edits, and the clash runtime opens the stage from its file.

On both backends, a query saves its results in the working clash store. Detection does not change the stage or the rendered scene. A one-shot run also exports a viewer session layer. The interactive viewer is a docked ovui (omni.ui) workspace. Its ovRTX render target follows the size of the viewport panel.

With point clouds enabled, the viewer narrows search set A to the Points prims at or under it. This is a viewer convention; the Suite runtime does not apply it. See Point clouds in search set A.

Packaging#

The app is a developer tool, not part of the product. Packaging keeps it out of both artifacts:

Artifact

Rule

Result

SDK install tree

CMakeLists.txt installs only the sample directories that hold a CMakeLists.txt (glob samples/*/CMakeLists.txt).

samples/ovrtx_clash_sample_app/ has none, so it is not installed.

Python wheel

scripts/build_wheel.cmake copies an explicit list: clash_suite_api, clash_api and legacy_clash_detection.

The app is not in the list.

The shipped changelog drops entries whose first line mentions ovRTX.

Launching it#

Run these commands from the ovclash directory. The two backends are independent: each has its own install tree and its own viewer venv. Before you begin, build and install the backend with build_<backend> --release --install, and check the prerequisites in the “Prerequisites” section of the sample README. Setup needs access to the public package indexes, unless you name local wheels as the “Environment variables” section of the sample README describes.

Goal

Linux

Windows

Interactive viewer, ovstage backend

./launch_rtx_viewer_ovstage.sh

.\launch_rtx_viewer_ovstage.bat

Interactive viewer, OpenUSD backend

./launch_rtx_viewer_openusd.sh

.\launch_rtx_viewer_openusd.bat

One-shot run, ovstage backend

./launch_rtx_viewer_ovstage.sh -- --one-shot

.\launch_rtx_viewer_ovstage.bat -- --one-shot

Prepare or refresh a viewer venv

./setup_ovrtx_viewer.sh --backend ovstage

.\setup_ovrtx_viewer.bat --backend ovstage

Prepare the ovstage venv through the build wrapper

–

.\build.bat --setup-ovrtx-viewer

Setup notes:

  • Pass --backend openusd to setup for the OpenUSD venv.

  • build.bat --setup-ovrtx-viewer runs setup_ovrtx_viewer.bat with its default ovstage backend and builds nothing. It forwards --build-local-ovui, which installs an editable local ovui checkout, and --build-local-ovstage, which skips the ovstage wheel for a local ovstage build. On Linux, pass these options to setup_ovrtx_viewer.sh directly.

  • In a Windows build tree, the setup_ovrtx_viewer CMake target prepares the venv for that tree’s backend.

The launchers do not build the backend. Each checks the library that OVCLASH_LIB names, by default _build/install/<backend>/bin/ovclash.dll on Windows or _build/install/<backend>/lib/libovclash.so on Linux. When it is missing, the launcher exits and names the command to run, for example ovstage ovclash native library not found: <path> followed by Run: ./build_ovstage.sh --release --install. Only the viewer venv is created automatically.

What a successful start looks like:

  • Setup ends with ovRTX viewer environment ready: <venv python> and exits with 0. A failed setup prints error: <reason> and exits with 1; a failed package download or install ends with pip’s own error. To set up without the indexes, name local wheels with OVRTX_WHEEL_PATH, OVSTAGE_WHEEL_PATH or OVCLASH_PIP_OVERRIDE_DIR and run setup again; --dry-run prints the commands first.

  • An interactive launcher prints Launching ovclash ovRTX viewer: and the app command line, and the viewer window opens.

  • A one-shot run prints its JSON summary on stdout and exits with 0. Its fields are listed under Validation.

The default ovui==0.2.0 wheels require CPython 3.12. The wrappers prefer the Packman CPython 3.12 under _build/deps/target-deps/python, which a build bootstraps. Without it, they fall back to py -3 or python on Windows and to python3 or python on Linux. When that interpreter is CPython 3.12, setup uses it. When it is another version, setup stops with error: The default ovui==0.2.0 wheels require CPython 3.12; found <implementation>:<version>. and further hints: build once so that the Packman interpreter exists, or run setup with CPython 3.12 directly, adding --force-recreate to replace an existing venv. Core ovclash still supports Python 3.10 or newer.

The sample directory also has run_ovrtx_clash_sample_app.bat and run_ovrtx_clash_sample_app.sh. They differ from the backend launchers:

  • They run launch_ovrtx_viewer.py with OVCLASH_LIB set to the _build/install/openusd library unless it is already set.

  • They leave the launcher’s --backend at ovstage. Pass --backend openusd to them, because the app rejects a backend that differs from the loaded library.

  • They do not set OVCLASH_DISABLE_BUNDLED_PLUGIN_PATHS. On Windows, they add no native directories to PATH or OVCLASH_DLL_DIRS.

What the launchers and setup do#

The launch_rtx_viewer_* wrappers:

  • set OVCLASH_VIEWER_BACKEND to their backend;

  • set OVCLASH_LIB to the backend’s install tree unless it is already set;

  • on Windows, put the install tree’s native directories on PATH and OVCLASH_DLL_DIRS. On Linux, only the ovstage wrapper sets a search path, LD_LIBRARY_PATH;

  • put python/ and samples/ on PYTHONPATH, so the viewer uses the checkout’s Python packages with the installed native library and needs no wheel;

  • set OVCLASH_DISABLE_BUNDLED_PLUGIN_PATHS=1 unless it is already set;

  • run launch_ovrtx_viewer.py --backend <backend>, preferring the Packman interpreter.

The ovstage wrappers also set OVCLASH_OVSTAGE_ROOT to an ovstage checkout beside the repository root unless it is already set. When that checkout’s _build directory holds a built ovstage runtime, they add it to the library search path. build_ovstage.* builds against the ovstage SDK staged under _build/deps/pip-deps/ unless local ovstage mode is on. Set OVCLASH_OVSTAGE_ROOT explicitly when a sibling ovstage checkout must not be picked up.

The variables that the wrappers set; a value you set first wins, except for OVCLASH_VIEWER_BACKEND:

Variable

Values

Required

Default

Effect

OVCLASH_VIEWER_BACKEND

ovstage, openusd

No

The wrapper’s backend

Selects the scene backend. The launcher’s --backend must match it when it is set.

OVCLASH_LIB

Absolute path of the native library

No

The backend’s install tree

The library that the launcher checks and the app loads

OVCLASH_OVSTAGE_ROOT

A directory

No

ovstage wrappers: an ovstage checkout beside the repository root

A built runtime under its _build joins the library search path

OVCLASH_DISABLE_BUNDLED_PLUGIN_PATHS

A flag

No

1

The ovclash loader adds no OpenUSD plugin paths; launch_ovrtx_viewer.py sets them instead

setup_ovrtx_viewer.py installs, in one pip command, the backend’s requirements file, the pinned ovRTX wheel, the stock ovstage wheel and ovui into the venv:

  • Only requirements_openusd.txt adds usd-core.

  • Every default source is a public package index, and no credential is involved. The ovRTX wheel comes from NVIDIA’s public package index, the one the PyPI ovrtx release installs from, and ovstage (ovstage==<OVSTAGE_VERSION>) and ovui from pip’s configured index.

  • When setup downloads the pinned ovRTX wheel, pip installs it only when its SHA-256 matches the pin in OVRTX_WHEEL_SHA256. A wheel from OVRTX_WHEEL_PATH or an override directory is installed as it is.

  • After an ovstage build, setup installs the ovstage wheel that the build downloaded and verified against OVSTAGE_SHA256SUMS, from _build/deps/downloads/ovstage, so it needs no index for ovstage. A cached file that no longer matches its pin is not used.

  • For the ovstage backend, setup checks the required public ovstage APIs after it installs. The launcher checks them again before it starts the UI, also with --skip-setup.

Setup reads these overrides from the environment (setup_ovrtx_viewer.py). For ovstage the first match wins: OVSTAGE_WHEEL_PATH, a wheel in an override directory, OVSTAGE_PIP_REQUIREMENT, the build’s verified cached wheel, then ovstage==<OVSTAGE_VERSION>.

Variable

Values

Required

Default

Effect

OVRTX_WHEEL_PATH

The path of an ovRTX wheel file

No

Unset: the pinned wheel, with its digest enforced

Installs that wheel as it is. A path that does not exist stops setup.

OVSTAGE_WHEEL_PATH

The path of an ovstage wheel file

No

Unset

Installs that wheel. A path that does not exist stops setup.

OVCLASH_PIP_OVERRIDE_DIR, then OVCLASH_PIP_SEED_DIR

A directory

No

Unset

Searched for the pinned ovRTX and ovstage wheel file names when the matching *_WHEEL_PATH is unset

OVSTAGE_PIP_REQUIREMENT

A pip requirement

No

Unset

Installs ovstage from that requirement when no local ovstage wheel is found

OVSTAGE_VERSION

An ovstage version

No

The OVSTAGE_VERSION file

The ovstage version that setup looks for and installs

OVUI_PIP_REQUIREMENT

A pip requirement or a wheel path

No

ovui==0.2.0

Replaces the ovui requirement, and skips the CPython 3.12 check

The app itself reads OVRTX_PYTHON_PATH, a directory to import ovrtx from, such as a local ovRTX checkout’s public/python. It retries from there when importing the installed ovrtx or checking its API fails; the app’s --ovrtx-python-path option takes precedence.

Run either script with --help for its options.

Building ovui from a local checkout#

--build-local-ovui installs an editable local ovui checkout. Setup looks for it in this order:

  • the directory that OVUI_SOURCE_ROOT, OVUI_ROOT or OVUI_REPO_ROOT names, or its ovui subdirectory;

  • the checkout whose python directory OVUI_PYTHON_PATH names;

  • an ovui directory in the project directory or one of its parents.

On Windows the build needs the Vulkan headers and loader. Setup uses the first complete source in this order:

  1. Vulkan_INCLUDE_DIR with Vulkan_LIBRARY.

  2. VULKAN_SDK, or the newest SDK under OVUI_VULKAN_SDK_PARENT or <system drive>/VulkanSDK.

  3. An existing vcpkg install for OVUI_VULKAN_TRIPLET (default x64-windows).

  4. vcpkg install of vulkan-headers and vulkan-loader, with the vcpkg from VCPKG_INSTALLATION_ROOT, VCPKG_ROOT, OVUI_VCPKG_ROOT or PATH. When no vcpkg exists and git is available, setup first clones and bootstraps vcpkg into OVUI_VCPKG_ROOT (default _build/deps/vcpkg).

Setup reads these variables from the environment:

Variable

Values

Required

Default

Effect

OVUI_SOURCE_ROOT, OVUI_ROOT, OVUI_REPO_ROOT

An ovui checkout, or a directory with an ovui subdirectory

No

Unset

The checkouts that setup tries first, in this order

OVUI_PYTHON_PATH

The python directory of an ovui checkout, which holds omni/ui

No

Unset

Names the checkout through its python directory

Vulkan_INCLUDE_DIR, Vulkan_LIBRARY

The Vulkan include directory and loader library

No; Windows only, both together

Unset

The first Vulkan source

VULKAN_SDK

A Vulkan SDK directory

No; Windows only

Unset

The second Vulkan source

OVUI_VULKAN_SDK_PARENT

A directory that holds Vulkan SDK versions

No; Windows only

Unset; <system drive>/VulkanSDK is searched after it

Its newest complete SDK is the second source when VULKAN_SDK names none

OVUI_VULKAN_TRIPLET

A vcpkg triplet

No; Windows only

x64-windows

The triplet of the vcpkg install

VCPKG_INSTALLATION_ROOT, VCPKG_ROOT, OVUI_VCPKG_ROOT

A vcpkg root directory

No; Windows only

Unset: vcpkg on PATH, else the one in _build/deps/vcpkg

The vcpkg that installs the headers and loader, tried in this order. Setup clones and bootstraps vcpkg into OVUI_VCPKG_ROOT, default _build/deps/vcpkg, when it finds none.

When a source is missing or fails, setup prints error: with a message that names the fix, and exits with 1:

  • No local ovui checkout, with a message that contains but no local ovui source checkout was found.: set OVUI_SOURCE_ROOT.

  • No Vulkan source and no git, with a message that contains Vulkan SDK and vcpkg were not found, and git is not on PATH to bootstrap a local vcpkg checkout.: install the LunarG Vulkan SDK or vcpkg, or set OVUI_VCPKG_ROOT.

  • A failed vcpkg install, with a message that contains vcpkg failed while installing ovui's Vulkan build prerequisites.: run the vcpkg command that the message names by hand, or set VULKAN_SDK, or Vulkan_INCLUDE_DIR with Vulkan_LIBRARY.

The Python launcher#

launch_ovrtx_viewer.py:

  • creates the venv, or reruns setup when the venv lacks a required package, omni.ui or, for ovstage, the required public ovstage APIs, or when an installed ovRTX, ovstage or ovui has another version than setup installs, as after a pin update. It stops when setup leaves such a version in place. stale_viewer_packages() in setup_ovrtx_viewer.py compares the versions; the import checks alone pass with any version;

  • prepares the process environment for ovui, the ovRTX binaries, the OpenUSD plugins and the shader caches;

  • starts samples/ovrtx_clash_sample_app/ovrtx_clash_sample_app.py with the venv Python in the output directory and forwards the arguments after -- to it.

The launcher exposes ovRTX’s core OpenUSD plugins only through OV_PXR_PLUGINPATH_2511. It keeps them and the _build/install/<backend>/plugins/usd trees out of PXR_PLUGINPATH_NAME, because mixing the two plugin registries can crash Python usd-core.

Its options:

Option

Meaning

--backend

Scene backend, default ovstage. The backend launchers pass their own. It must match OVCLASH_VIEWER_BACKEND when that is set.

--venv-dir

Viewer venv, default _build/deps/venv/ovrtx_viewer_<backend>.

--output-dir

Working directory of the app, for viewer state and the ovRTX cache. Default _build/viewer/<backend>/<configuration>. <configuration> is the build type that the backend install records in ovclash-build-provenance.json, or Release when it records no Debug or Release build type.

--resolution

Initial interactive render size and window size hint, default 1280x720.

--force-setup

Rerun setup before launching. An existing venv is updated, not recreated.

--skip-setup

Do not create or update the venv unless --force-setup is given. Fail when the venv is missing or, for ovstage, lacks the scene services. Warn when a pinned package has another version.

--in-process

Run the app in the launcher’s Python process.

--wait-on-error

Keep the console open after an in-process error, so the traceback stays readable.

Version pins#

Pin

Source of truth

Override

ovRTX wheel

OVRTX_VERSION and the OVRTX_WHEEL_SHA256 digests in setup_ovrtx_viewer.py

OVRTX_WHEEL_PATH for a local wheel; OVRTX_PYTHON_PATH or the app’s --ovrtx-python-path for a local ovRTX checkout

ovstage wheel

the OVSTAGE_VERSION file

the OVSTAGE_VERSION environment variable, OVSTAGE_PIP_REQUIREMENT, OVSTAGE_WHEEL_PATH

ovui

DEFAULT_OVUI_PIP_REQUIREMENT in setup_ovrtx_viewer.py

OVUI_PIP_REQUIREMENT, or --build-local-ovui with OVUI_SOURCE_ROOT

Python OpenUSD (OpenUSD viewer and smoke only)

usd-core in samples/ovrtx_clash_sample_app/requirements_openusd.txt

–

Default pins name official releases, and setup installs them from public package indexes only. Pin an ovRTX or ovstage version only once it is published there: a public source tree must set up with its default pins.

The ovRTX version and its wheel digests are written in several files. Change all of them together, and take each digest from that wheel’s #sha256= link on the ovrtx page of OVRTX_PACKAGE_INDEX, NVIDIA’s public package index:

  • OVRTX_VERSION and the OVRTX_WHEEL_SHA256 table in setup_ovrtx_viewer.py;

  • OVRTX_VERSION and the OVRTX_WHEEL_URLS and OVRTX_WHEEL_SHA256 tables in samples/ovrtx_clash_sample_app/config.py;

  • _OVRTX_VERSION and the three _OVRTX_WHEEL_SHA256 values in scripts/test_ovrtx_sample.cmake;

  • the expected version in test_viewer_release_pins_agree_across_setup_sample_and_cmake (tests/python_tests/test_ovrtx_viewer_scripts.py), which fails when the code copies disagree;

  • the ovRTX row of the dependency table in the “Viewer environment” section of the sample README.

CI does not render (see Validation), so run the render smoke on a GPU machine after an ovRTX bump, for example with --one-shot --render-smoke --require-ovrtx after -- on a backend launcher. With --require-ovrtx, a render failure fails the run with its error; with --render-smoke alone, the run prints ovrtx render smoke skipped: <reason> and reports the reason as render_skipped in its JSON summary. Run it as a normal desktop process, as the “Rendering” section of the sample README advises.

The usd-core version is also written in several files. Change them together:

  • usd-core in samples/ovrtx_clash_sample_app/requirements_openusd.txt;

  • the viewer-openusd extra in python/pyproject.toml;

  • _PYTHON_USD_CORE_VERSION in scripts/test_ovrtx_sample.cmake;

  • the expected version in test_only_openusd_requirements_install_python_usd (tests/python_tests/test_ovrtx_backend_environments.py), which checks only requirements_openusd.txt;

  • the requirements row of the dependency table in the “Viewer environment” section of the sample README;

  • the viewer-openusd row of Compatibility (docs/consumer/compatibility.md).

The OVSTAGE_VERSION file is the ovstage pin of the whole project. The backend builds, the wheel and the viewer setup all read it. After you change it, run python scripts/sync_ovstage_version.py --write:

  • It rewrites the ovstage== pin in python/pyproject.toml and the documented default, the Defaults to sentence, in README.md and in the “Environment variables” section of the sample README.

  • It fails unless each file holds exactly one such pin or sentence.

  • An ovstage wheel build runs it with --check and stops when a file is stale.

Validation#

The test_ovrtx_sample CMake target validates the app; scripts/test_ovrtx_sample.cmake implements it. It runs against the installed native library of the build tree’s backend. It installs its Python dependencies into a separate venv, _build/deps/venv/ovrtx_sample_<backend>. It:

  1. runs the canonical Warp buffer-view unittest, test_runtime.ClashRuntimeTests.test_report_buffers_can_be_viewed_as_warp_arrays, once Warp has started in a separate probe process;

  2. runs the one-shot smoke on tests/data/mesh_mesh_overlapping.usda;

  3. checks that the exported viewer_session.usda composes that source scene.

Details:

  • For the ovstage backend, it installs the stock ovstage wheel through setup_ovrtx_viewer.py, which checks the required public APIs.

  • Warp is a native third-party runtime, and on some hosts starting it ends the process natively, without a Python traceback. scripts/run_with_warp_runtime_probe.py therefore first runs import warp, warp.init() and zero-copy CPU Warp arrays over NumPy buffers in a process that loads no ovclash code, and prints each step before it takes it:

    • When that process ends natively before its last step, the step fails by default. On Windows that is an NTSTATUS error code such as 0xC0000409, or exit code 3; elsewhere a signal.

    • Only when OVCLASH_ALLOW_WARP_STARTUP_SKIP is true does the step skip the Warp unittest instead, with a CMake warning, and still run the one-shot smoke. It is read from -D on a direct cmake -P run, which wins, or from the environment, the form a --validate run passes on. Set it only on a host where Warp is known not to start.

    • A Python error, a hang or an early exit of the probe, and a native end after its last step, such as a crash at interpreter exit, fail the step with or without the switch.

    • A host without a usable CUDA driver normally passes the probe, because Warp falls back to its CPU device.

  • The Warp unittest and the one-shot smoke run with PYTHONFAULTHANDLER=1, so a crash that Python still sees prints its Python stack.

  • On Linux aarch64 the OpenUSD backend’s smoke skips with a message: usd-core has no wheel for that platform.

  • The smoke’s stdout, including the JSON result, goes to ovrtx_clash_sample_app_smoke/one-shot.log in the build tree’s validation directory, _build/validation/<backend>/<generator>/<configuration>/. <generator> is vs or ninja. A build directory outside _build/compile gets an external-<id> namespace instead.

  • validate_all includes the target.

By default the smoke does not render. It covers detection, result persistence and session-layer export, and installs no ovRTX:

  • Set OVCLASH_TEST_OVRTX to add the render smoke, which needs a GPU and Vulkan. A true CMake variable enables it, and so does any non-empty environment value, OFF included.

  • CI leaves it unset, so no CI job renders. A passing run without rendering does not prove ovRTX rendering; record the GPU coverage that you skipped.

  • Without rendering the step needs no GPU, but it installs its Python packages from the package indexes. To drop it from a --validate run, for example on a host without access to them, set OVCLASH_VALIDATE_EXCLUDE_TARGETS=test_ovrtx_sample.

With rendering enabled:

  • The smoke reuses an installed default ovRTX release only after ovrtx_release_ready() in setup_ovrtx_viewer.py verifies its pinned archive digest, files and API. Otherwise it installs the pinned URL with that digest enforced.

  • It always reinstalls a wheel from OVRTX_WHEEL_PATH or a pip override directory.

  • A non-empty OVRTX_PYTHON_PATH uses that ovRTX instead of installing one.

  • On OpenUSD, the render runs in a child process limited by OVCLASH_RENDER_SMOKE_TIMEOUT_SECONDS (default 120). Cold shader compilation can exceed that limit; the “One-shot runs” section of the sample README gives the value for a cold-cache run.

  • On ovstage, the render runs in the owning process on the Stage that is already open. The renderer closes before its owner.

The smoke reads these variables:

Variable

Values

Required

Default

Effect

OVCLASH_TEST_OVRTX

A true CMake variable, or any non-empty environment value

No

Unset: no rendering

Adds the render smoke

OVCLASH_RENDER_SMOKE_TIMEOUT_SECONDS

Seconds

No

120

Limits the OpenUSD render child process

OVCLASH_ALLOW_WARP_STARTUP_SKIP

A CMake boolean, from -D or the environment

No

False

Skips the Warp unittest, with a warning, when Warp ends natively at startup

A one-shot run saves its query and results in one_shot.ovclashdb, writes viewer_session.usda and reports that path as session_layer in the JSON result on stdout. Through a launcher, these files land in _build/viewer/<backend>/<configuration> unless you pass --output-dir. The “One-shot runs” section of the sample README lists the point-cloud and render variants. samples/ovrtx_clash_sample_app/main.py writes these fields, all of them on every run:

Field

Type

Required

Default or values

Description

source

string

Yes

An absolute path

The source stage

overlaps

integer

Yes

–

The overlap count of the query

session_layer

string

Yes

A path in the output directory

The exported viewer_session.usda

clash_timing

string

Yes

–

A one-line summary of the phase times

phase_timings

array of objects

Yes

name, seconds, rss_delta_bytes, private_delta_bytes, memory_start, memory_end

The duration and memory use of each phase

detailed_timings

array of objects

Yes

level, name, seconds, detail

The finer timings

render_skipped

string or null

Yes

null when the run rendered or no render was requested

Why --render-smoke could not render

warp_cache_path

string or null

Yes

The WARP_CACHE_PATH environment value

The Warp kernel cache that the run used

The Python tests under tests/sample_app_tests/ run in the opt-in test_python_sample_app target. CI appends it to the --validate run of every build job outside a release; add it to a local run through OVCLASH_VALIDATE_EXTRA_TARGETS. Tests that need Python pxr skip where it is unavailable.

tests/diagnostics/rtx_viewer_ovstage_isolation.py is an opt-in check of the real ovstage integration. Run it in the prepared ovstage viewer venv, which has no usd-core:

  • It checks one source open, the shared Stage identity, queries over unsaved edits, saving to a new file, New Stage and that no Python OpenUSD module is imported.

  • --render adds rendering on the shared Stage, pixel checks of a live parent transform and its reversal before commit, a query while ovRTX stays attached, a resize and explicit resource closure. It needs the ovRTX wheel and a GPU. On a host without them, leave out --render. Run a GPU diagnostic as a normal desktop process: a restricted agent sandbox can render but block the renderer’s shutdown, as the “Rendering” section of the sample README notes.

The “Developer checks” section of the sample README gives the environment and the command. Each run creates a new run directory under --output-dir, by default _build/rtx_viewer_isolation_acceptance, and prints its path first.

Debugging the native library under the viewer#

On Windows, the rtx_viewer target (source/RtxViewerDebugEntrypoint.cpp) supports F5 debugging in the Visual Studio solution:

  • It embeds the packaged Python runtime and runs launch_ovrtx_viewer.py --skip-setup --in-process --wait-on-error in one process.

  • It loads ovclash.dll from the build output directory, next to its PDB (program database).

  • Its output directory is the launchers’ _build/viewer/<backend>/<configuration> root for the selected configuration.

See Visual Studio solutions and F5 debugging in the Technical Guide.

On Linux there is no such target: rtx_viewer and setup_ovrtx_viewer are Windows-only (CMake targets).

Scene ownership and modules#

On the default ovstage scene backend, one OvstageScene (scene/ovstage.py) owns the Stage:

  1. It opens the source file once with the ovstage population API. It owns inspection and edits.

  2. A query borrows that Stage through ClashDetection.attach_ovstage(), unsaved edits included, and passes the composition of its query lease. Default selection reads the borrowed Stage. The clash runtime evaluates every finite time in private native populations of that composition and never evaluates or advances the Stage. Viewer code never reopens the file, and the binding never destroys the Stage.

  3. ovRTX attaches to the same Stage with renderer.attach_ovstage(). The scene detaches the renderer before it destroys the Stage.

Viewer code on this path imports no Python OpenUSD. It composes typed USDA user and viewer overlays through public ovstage APIs. Using ovclash with an ovstage Stage gives the attach and owner-operation rules that any Stage owner follows.

These modules hold the rules of Viewer implementation rules. The module map in the “How the code works” section of the sample README lists the other viewer_parts/ modules, including the mixins that panels.py and properties.py compose.

Module

What it owns

scene/ovstage.py

OvstageScene: the Stage, the owner gate and scene lock, query leases, publications, saves and renderer attachment

scene/ovstage_runtime.py

SceneDocument: time evaluation, Default visibility repair, query publication and the query composition

scene/ovstage_layers.py

StockLayers: the typed user and viewer overlays, the texts of their surviving references and the saved composition wrapper

scene/ovstage_inspection.py

StockInspection and population_desc()

scene/ovstage_path_lists.py, ovstage_path_strings.py, ovstage_core_values.py, ovstage_geometry_batches.py

Bounded read and write helpers for inspection and Default publication

runtime/renderer.py

The ovRTX renderer wrapper: stepping, frame mapping and renderer ownership

viewer_parts/app.py

The main loop, including the wait for a running query

viewer_parts/clash_controller.py

Query start: scope resolution and the query lease

viewer_parts/clash_detection_table.py

The result table

viewer_parts/query_management_fields.py

The Query Management settings pane, including the point-cloud label and the ROI (region of interest) rows

clash_flow.py

Query execution on the borrowed Stage or in the isolated worker

Point clouds in search set A#

When a query enables point clouds, the viewer narrows search set A to the Points prims at or under its paths and leaves search set B untouched. The “Point-cloud queries” section of the sample README describes what a user sees. The runtime does not do this: it always runs mesh vs mesh and adds point vs mesh (Point clouds are additive), so without the narrowing a search set A that also holds meshes would still produce mesh-vs-mesh results. The Kit clash detection window applies the same convention.

How the viewer narrows the set:

  • On ovstage, viewer_parts/clash_controller.py selects the paths from the scene’s prim index (type_name == "Points") before it takes the query lease. With SETTING_IGNORE_INVISIBLE_PRIMS on, the default, it skips invisible prims.

  • On OpenUSD, clash_flow.py resolves the same set with Python OpenUSD.

  • The Suite ABI and omni.physxclashdetectioncore stay free of pxr.

Consequences:

  • The label Point Cloud(s) in Searchset A in Query Management is a promise of this app, not of the runtime.

  • A UsdGeomPoints prim in search set B still clashes as a point cloud.

  • On ovstage, a point cloud inside an instanced asset contributes no geometry. The viewer reports a warning on the progress line.

Point-cloud ROI fields#

Point Cloud Inclusion ROI and Point Cloud Exclusion ROI (roi_include_path, roi_exclude_path) are stored with the query. Query duplication, export and import keep them. No ovclash code applies them, because ovclash has no point-cloud extraction step; see Settings.

  • Query Management always hides the exclusion row, as the Kit clash query window does.

  • The inclusion row stays visible, so that the stored value can be inspected and edited. Its tooltip says that the value is stored but not applied.

Viewer implementation rules#

Owner gate.

  • Every public OvstageScene method except stage_info() and the revision properties enters the process-wide ovstage owner gate (run_ovstage_owner_operation) first, and the scene’s reentrant lock second. With OVCLASH_VIEWER_OWNER_EVALUATION, native time evaluation already holds the gate when it calls back into the scene, so every path keeps this lock order.

  • The native gate also serializes the lifecycle of file-backed ovstage contexts, of the private populations that replay a query composition, and of attached evaluate_time callbacks. Collision work and data-plane reads do not take it. The scene never holds the gate while it waits for a clash call.

  • Renderer preparation, stepping and frame mapping run as one operation (run_renderer_operation()), so a query lease cannot start between publication and mapping.

  • CUDA frame mappings stay owned until their release. Detaching a renderer releases its outstanding frames first.

  • The renderer wrapper destroys only a renderer that it created.

Query leases.

  • A query takes an exclusive scene lease (acquire_query_scene()) before its worker starts. While the lease is active, the scene rejects edits, inspection and rendering with RuntimeError. The viewer therefore holds editing, playback, render commits, reload and save until detection and persistence finish.

  • The lease publishes Default once, with the viewer layer muted, and reports the composition of that publication as a QueryComposition: the exact source string the Stage was opened from, which stays the original file after Save As, and the texts of the surviving "/" references (StockLayers.active_texts()), in the order they were added. It captures both under the scene lock, after the publication composed every deferred change, so they equal the population sealed at the lease ordinal. The scene is not published again until the lease closes, and closing restores the saved mutes and time.

  • OVCLASH_VIEWER_OWNER_EVALUATION is a sample-only diagnostic. It keeps the earlier owner-evaluated attachment, in which the clash runtime publishes every sample time on the scene through evaluate_time with the authored-transform capability, for A/B checks.

  • While the worker runs, the main loop waits up to 16 ms for it after each native UI tick (_CLASH_WORKER_YIELD_SECONDS). The native UI tick can hold the GIL through vsync. The wait gives the worker’s Python steps, and with owner evaluation its owner callbacks, time to run.

Publications. A publication is one write of the viewer’s composed scene into its Stage, sealed at a new ordinal; a Default publication writes the Default-time values.

  • Every publication takes a new ordinal, reserved before the native calls. A failed attempt therefore never reuses an ordinal. An unchanged frame reuses its publication.

  • A query lease reserves ordinal capacity, so that it can always restore the previous time and layer mutes.

  • A failed restoration, or a layer replacement that applied only in part, quarantines the scene. Edits, inspection and rendering then fail until the scene is closed and reopened.

  • A save folds the pending user edits into the baseline layer before it writes the composition wrapper. It writes the wrapper to a temporary sibling file and then replaces the target atomically. When the write fails, the previous references are restored.

  • When a save commits but the following publication fails, SceneSavePublicationError keeps the saved path and reports the failed step. A failed write of the clash data file beside the stage is reported separately, and the clash data stays marked unsaved.

Renderer refresh. After the first successful step of an attached renderer, ovRTX needs fresh viewer notices before it produces a frame. Unmuting the viewer layer, as a query lease or source inspection does, requires the same refresh. The wrapper records that step, publishes the viewer layer again and steps once more inside the same owner operation. It then exposes only the refreshed frame.

Camera and drag previews.

  • A camera-only update writes the camera matrix to the renderer and inspection columns through public ovstage attributes, at one new sealed ordinal. It does not repopulate USD. It does not rewrite the camera’s reset-stack flag, which the full publication already set, because that write would force extra synchronization with RTX.

  • A drag preview writes the local matrices, reset-stack flags and transform-op orders of every dragged prim in one publication. With an attached renderer, it computes the incremental GPU transform hierarchy before sealing that ordinal; the default CPU hierarchy alone leaves RTX geometry at its previous pose. It invalidates the cached composed transforms, so descendants, reset boundaries and bounds are recomputed.

  • On ovstage, mouse callbacks queue the latest pose. The main frame loop publishes it at most 30 times per second, immediately before rendering. This keeps native write and synchronization waits outside UI input dispatch. Release commits the final pose and clears any queued preview.

  • Prims that consume the dragged prims through references or inherits update at the next full composition: gesture commit, time change, query or save.

  • While a private viewer prim collides with a source path, previews use full composition instead, so that they cannot overwrite the stronger viewer opinions.

Default visibility. Default visibility values that the viewer wrote are restored before the next population. Population skips unchanged values, so coalesced resampling can leave flattened instance children with stale derived visibility. At that transition, and after source composition changes, the scene repairs the renderer visibility from the source hierarchy before it seals the publication.

Caches.

  • Stock inspection caches hierarchy and transform records only for the current publication.

  • Native attached reads keep the prototype associations of instance roots until the owner seals another ordinal or a source reset retires them. The associations are read lazily, once per ordinal.

  • With OVCLASH_VIEWER_OWNER_EVALUATION, a numeric query on the borrowed Stage uses the poses that stock population published. For the lease, it keeps only the instance roots excluded from collision. It discards them when the instance links, renderer membership, prim count or retained change history no longer match. No sampled transform or geometry value is cached. When the owner’s time evaluation or the association read fails, the next request for the same time asks the owner for a new publication instead of reusing the old one.

Result table. Result rows keep their formatted strings. They create native SimpleStringModel objects only when a cell model is accessed, so a large query does not allocate every column model before its rows are shown.

Viewer population and inspection#

The ovstage scene backend populates one Stage, then runs Python inspection and the Default publication, and only then attaches the renderer. On a large stage each of these phases costs load time. Measure population, inspection, renderer attachment and the first frame as separate phases.

Regression tests in tests/sample_app_tests/ pin the rules of this section with call, copy and allocation budgets, for example test_ovstage_path_lists.py, test_ovstage_path_strings.py, test_ovstage_core_values.py, test_ovstage_publication_buffers.py and test_ovstage_mesh_geometry_batches.py.

The scene creates its first Stage inside an owner operation, before it populates the source file. When that operation returns, the gate finds the omni client that the new Stage loaded and configures its process-wide retry policy, so that the policy applies to the file population. OVCLASH_OMNI_CLIENT_RETRY_MAX_MS sets that policy and defaults to 0, which disables reconnect retries. Without this order, the policy would not apply yet, and an unreachable Nucleus payload would stall the first population for the runtime’s own reconnect window. See the environment variables.

Population descriptor#

population_desc() in scene/ovstage_inspection.py describes the RENDERING-domain population:

  • Two mutually exclusive selectors, one for non-light prims and one for LightAPI prims, so every prim matches exactly one. A third, all-prim selector would repeat population work for every prim.

  • Both selectors take purpose only when it is authored, so that a schema-fallback purpose cannot overwrite the inherited rendering purpose.

  • Every selected property also publishes four metadata fields: typeName, custom, allowedTokens and default. Prims publish typeName and instanceable, and the stage publishes its metadata.

The description is an ovstage population.Desc, whose fields all have defaults in ovstage; the viewer sets them as follows:

Field

Type

Required

Default or values

Description

domains

PopulationDomain

No (ovstage default NONE)

RENDERING

The RENDERING domain populates the renderer’s prims and columns

selectors

sequence of Selector

No (ovstage default empty)

Two selectors: prims without LightAPI, and prims with it

Each selects every property except the renderer-owned ones (the omni:rtx namespace, inputs:shaping:focusTint, sourceName, productName) and takes purpose only when it is authored. The light selector also leaves out the light inputs that rendering migrates.

Selector.prim_metadata_paths

sequence of str

No (ovstage default empty)

typeName, instanceable

The prim metadata that each selector publishes

Selector.property_metadata_paths

sequence of str

No (ovstage default empty)

typeName, custom, allowedTokens, default

The property metadata that each selector publishes

stage_metadata_paths

sequence of str

No (ovstage default empty)

_STAGE_METADATA in scene/ovstage_inspection.py

The stage metadata that the population publishes

Inspection, editing, the geometry fallback and saving rely on these fields. They make the viewer’s population much more expensive than a clash-geometry population. Do not narrow the descriptor to a property whitelist: a value clip can supply builtins such as widths, velocities and primvars:displayOpacity that have neither an authored declaration nor a Default opinion. test_parent_value_clips_preserve_child_property_types_and_time_values in tests/sample_app_tests/test_ovstage_stock_publication.py covers those three. Reducing the metadata cost needs a narrower or on-demand metadata API in ovstage.

Inspection reads#

  • A selected-path read can share one prim list among many sparse property groups. ReadPathLists (scene/ovstage_path_lists.py) copies each distinct list once into an owned, read-only uint64 array. Paths are decoded only for the returned rows. The list work is therefore O(P + R) for P prims and R returned rows, not O(P * C) for C groups that share the list.

  • The cache holds a native reference on every cached list handle, so a handle cannot be recycled while it is cached. It keeps at most 64 lists and 64 MiB per read; one larger list may be kept alone. It releases every reference before the read, the query and the dictionary close, also on failure.

  • Known columns on explicit paths are read through query_from_path_list, without a scene-wide attribute-discovery query.

  • scene/ovstage_path_strings.py decodes paths in batches through the public dictionary API. Its path and token caches belong to one Stage, so native token decoding scales with the number of distinct tokens. Composing a path string still costs O(path components).

  • The core read stores compact four-field records (CoreValue in scene/ovstage_core_values.py) and reads unused core payloads as presence only. It still traverses the instance-expanded RENDERING-domain population, which can be much larger than the authored prim inventory.

  • StockInspection._read reads is_array and is_delete once per native group, because they are constant across the group’s rows, and decides array omission once per group.

Default publication#

  • Local poses and reset flags are written from contiguous owned buffers: float64 with shape (N, 4, 4) and bool with shape (N). They do not go through public transform snapshots.

  • scene/ovstage_geometry_batches.py writes Default fallback mesh geometry in batches of meshes that share one field set, through the public ragged-array write API. One staging window holds at most 4,096 meshes and 128 MiB of write payload. A mesh larger than the byte budget is written alone. Avoid a query, a write and a wait per mesh.

  • The first render after a renderer attaches needs one more full publication; see Renderer refresh in Viewer implementation rules.

  • replace_user_edits([]) returns the current revision without publishing when no user opinions exist, the scene is clean and no source recomposition is pending. Its health checks run first. Clearing real edits, or publishing pending view changes, still advances the revision.