Developer Guide#

This guide states the runtime rules that both API layers and both languages share: how the Suite API wraps the canonical API, when settings apply, how stages and scopes load, which parts of a result are contractual, how failures surface and which environment variables the runtime reads. The Python Quickstart and the C/C++ Quickstart get a first query running. Come back here to check the rules.

Each rule applies to both API layers unless its section names one. To pick a layer, read Choosing an API Layer first. Settings is the reference for every setting.

The released packages use the ovstage backend, and this guide describes it. The unpublished OpenUSD reference build differs in places; the comments in <ovclash/ovclash.h> and the Suite headers document each difference, and References in the package lists those headers.

The examples use scene.usda, a USD file, as the stage. A fragment that does not create its own handle assumes one with that stage open:

  • a canonical C fragment, a context ctx from ovclash_create_context;

  • a Suite C fragment, a runtime from ovclash_suite_create_runtime;

  • a Python fragment, a runtime from ClashRuntime().

On this page#

Ownership, threading and async runs#

These rules have their own pages:

Rule

Details

A handle has no internal lock. Drive one context or runtime from one thread at a time, or serialize the calls. Independent runtime handles may run concurrently.

What a context owns

Returned names, strings and report buffers are borrowed. Copy them before the next call that changes their owner. Release every overlap report.

Borrowed memory

A context runs one asynchronous operation at a time. While it runs, the context rejects almost every other call, and only finishing the run lifts that guard.

The asynchronous pipeline

Releasing a context or destroying a Suite runtime waits for a live run. It does not cancel it.

Releasing a context is not instant

A live Suite fetch operation or cursor reserves its runtime and store.

Suite fetch and cursor lifetime

The C status results, string views and input rules are in C API Conventions.

Suite runtime wrapper#

include/ovclash_suite/ovclash_suite.h (SDK archive) declares the Suite C ABI, which wraps the canonical clash C ABI. Both are compiled into the same shared library; there is no separate Suite library to link. The ovclash_suite Python package binds it. The Suite API adds:

  • status results (ovclash_suite_result_t);

  • counted UTF-8 strings (ovclash_suite_string_t);

  • stricter input validation;

  • the native models ClashQuery, ClashInfo, ClashFrameInfo and PointCloudSettings;

  • persistence to a SQLite or JSON-directory store, incremental fetch-and-save, and JSON and HTML export;

  • thread-local last-error text for handle-free and generic errors.

ovclash_suite_create_clash_info converts one runtime overlap record into three objects:

  • an ovclash_suite_clash_info_view_t;

  • an ovclash_suite_clash_frame_info_view_t;

  • an owned ovclash_suite_overlap_report_t over the runtime’s report buffers. It requests OVCLASH_SUITE_OVERLAP_REPORT_POINTS0 for a point-vs-mesh pair and FACES0 | FACES1 | OUTLINE for a mesh pair.

The report follows the rules in Suite reports. The clash-info strings belong to the runtime. They stay valid until the next ovclash_suite_create_clash_info, ovclash_suite_runtime_save_overlap_to_data or fetch-and-save capture on that runtime.

Note

Test a pair type with == against the member you mean, OVCLASH_SUITE_OVERLAP_POINT_CLOUD_MESH or OVCLASH_OVERLAP_PAIR_TYPE_POINT_VS_MESH. Never test it with != against the mesh value: both undefined values are 0x7fffffff, not zero.

ovclash_suite_runtime_save_overlap_to_data converts one runtime overlap and saves it straight into an open data handle. This avoids a Python round trip for every frame and report buffer. A record that the engine cannot report is dropped instead of failing the call; Persistence shows how to detect that.

The depth entry points are mesh-only#

  • ovclash_suite_compute_overlap_max_local_depth rejects a point-cloud overlap.

  • ovclash_suite_compute_max_local_depth and ovclash_suite_compute_penetration_depth fail for the path of a UsdGeomPoints point cloud, because a points prim is never loaded as a mesh.

  • ovclash_suite_compute_max_local_depth also fails unless the settings in effect enable compute_max_local_depth. The engine defaults do not.

In Python, ClashDetection.is_depth_computation_supported(overlap_type) is the pre-check for ovclash_suite_compute_max_local_depth and ovclash_suite_compute_penetration_depth. Their Python methods raise instead of returning a depth.

Settings#

Settings lists every setting with its name in each API, its default, its unit and its effect. This section says when a changed setting takes effect.

  • A setter stores its value when you call it. Nothing waits for pipeline creation. A rejected call stores nothing and keeps the previous value.

  • The pipeline plans the steps from the times. ovclash_create_pipeline (ovclash_suite_create_pipeline) derives the step plan from the start time, the end time and the sampling rate. The pipeline keeps that plan, so a later change of the times applies to the next pipeline.

  • The phases read the other settings when they run. The selection settings, such as the scope, full-scene traversal, invisible-prim filtering and point clouds, apply when a run selects meshes. The cooking settings, such as triangles per leaf, quantized trees and the area epsilon, apply to meshes cooked by the next run.

  • Configure settings before you create the pipeline, and keep them while its steps run. A run keeps the subcomponent filtering it selected meshes with (the filter that skips a pair whose two meshes share a subcomponent root; see Scope and selection), while a new point size applies from the run’s next sample. Change settings between runs, not between steps.

  • Settings never recompute or discard completed results. The threading settings also govern report extraction and fetch-and-save frame preparation after detection. You can therefore detect in parallel and fetch single-threaded: change the threading settings after detection and before the fetch begins.

  • Settings calls are rejected while an async pipeline is live, and on the Suite API while a fetch operation is alive.

Each surface applies settings in its own way:

  • ovclash_set_settings and ovclash_set_full_scene clear the canonical scope paths, so set the scope after them. The Python ClashRuntime and the Suite API apply their cached scope again, so there the order does not matter; see Setting a scope.

  • ClashRuntime.set_run_settings() resets every setting that RunSettings does not model. It closes open overlap reports and discards the pipeline; completed results stay.

  • ClashDetection.set_settings() sets the whole table: a key you do not pass takes its default.

Time units#

Query bounds and result times are in seconds on both layers. To get USD time codes, multiply seconds by the stage’s effective rate. The effective rate is the authored timeCodesPerSecond, else the authored framesPerSecond, else 24.

To read the stage rate

Call

Canonical C

ovclash_get_stage_timeline_data

Suite C

ovclash_suite_get_stage_timeline_data

Python

ClashRuntime.get_stage_timeline_data() or ClashDetection.get_stage_timeline()

All of them read the rate from the open stage. The timeCodesPerSecond and time_codes_per_second settings set the query sampling rate independently of that stage rate. Functions that take USD time codes, such as ovclash_get_prim_matrix, say so.

Scope and stage loading#

Opening a stage#

ovclash_open_stage(context, path) takes a UTF-8 ovclash_string_t that names an existing local file. Asset URIs that are not plain files are rejected before any USD or ovstage resolution. The Python open_stage() methods follow the same rules and raise RuntimeError on failure.

  • A successful open replaces the context’s stage and clears its scope.

  • Opening the same path again is still a replacement and reads the file again.

An open attempt that gets past argument validation retires the previous results, whether or not it succeeds:

  • Detail getters fail with a “result details are stale” message until a pipeline runs again. Aggregate counts are kept, but name views that the getters already returned are invalid.

  • A started pipeline must restart at step 0.

  • A failed open drops the previous stage, so the context has no source until the next successful open.

Opening a stage does not restore OVCLASH_SETTINGS_FLAG_FULL_SCENE after ovclash_set_scope_paths cleared it; see Setting a scope.

Setting a scope#

ovclash_set_scope_paths(context, paths1, paths1_count, paths2, paths2_count) takes UTF-8 path arrays. Standalone callers should use it. Validation is all-or-nothing: the context scope changes only after every entry passes. A scope entry also covers its descendants.

paths1

paths2

Meaning

Non-empty

Empty

paths1 against itself

Non-empty

Non-empty

paths1 against paths2. A mesh in both scopes belongs to paths1 only, so identical scopes produce no mesh-vs-mesh pairs.

Empty

Empty

No scope

The scope is read when a run selects meshes, so a call between the steps of a run does not change that run.

No scope is not the same as full-scene traversal. Selection reads two independent pieces of state:

Scope

FULL_SCENE

Selected

Non-empty

Either

The scope

Empty

Set

The whole stage

Empty

Cleared

Nothing at all

The flag starts set on a fresh context.

Note

Applying a non-empty scope clears FULL_SCENE. ovclash_set_scope_paths clears it; the legacy ovclash_set_scope does not. Clearing the scope does not restore the flag. Neither does opening a stage or attaching one with ovclash_ovstage_attach_stage. Both of those also clear the scope, so set the scope after them. Restore full-scene traversal with ovclash_set_full_scene(context, true) or with settings that enable OVCLASH_SETTINGS_FLAG_FULL_SCENE. Both of those calls clear the scope paths, so call them before you set a non-empty scope.

#include <ovclash/ovclash.h>

ovclash_string_t a[] = { { "/World/Objects/meshA", 20 } };
ovclash_string_t b[] = { { "/World/Objects/meshB", 20 } };
ovclash_set_scope_paths(ctx, a, 1, b, 1); /* also clears FULL_SCENE */

/* Later, back to full-scene traversal: */
ovclash_set_scope_paths(ctx, NULL, 0, NULL, 0); /* no scope; FULL_SCENE stays cleared */
ovclash_set_full_scene(ctx, true);

The Python ClashRuntime and the Suite API handle this order for you. They cache the explicit A/B scope and apply it again just before the pipeline is built. The Suite API also applies it after each successful ovclash_suite_set_run_settings. You can therefore set scope and run settings in either order. The cache follows these rules:

  • A successful open (ClashRuntime.open_stage(), ovclash_suite_open_stage) or ovstage attach clears the cached scope, as the engine clears its own. A failed open keeps it, and so does a reset.

  • The Suite Python ClashDetection.set_settings() and set_scope() reopen their stage argument in two cases only: it names a different file from the open one, or a failed open dropped the stage. Another spelling of the open file, such as a pathlib.Path or a layer’s absolute realPath, keeps the cached scope.

  • The Suite API restores full-scene traversal after a both-empty ovclash_suite_set_scope, a successful open or an ovstage attach, when the settings in effect enable enable_full_scene. Those are the last applied settings or, before any successful apply, the engine defaults.

  • ClashRuntime does not restore full-scene traversal by itself. Clear the scope and enable enable_full_scene before you rebuild the pipeline:

runtime.set_scope(["/World/Objects/meshA"], ["/World/Objects/meshB"])
runtime.run_pipeline()

# Back to full-scene traversal:
runtime.set_scope([], [])
runtime.set_run_settings(runtime.get_run_settings(), enable_full_scene=True)
runtime.run_pipeline()

Point clouds are additive#

OVCLASH_SETTINGS_FLAG_ENABLE_POINT_CLOUDS does not switch a query into a point-only mode. The mesh-vs-mesh pass runs exactly as it does without the flag, and a point-vs-mesh pass adds its results to the same result set.

No scope is filtered by prim type, and the point-vs-mesh broad phase does not separate the two scopes. A UsdGeomPoints prim in scope B is therefore a live point cloud. It is tested against every selected mesh, scope B’s own included.

Three consequences follow:

  • A scope A that holds both meshes and point clouds yields mesh-vs-mesh and point-vs-mesh results. Narrowing scope A to point clouds is a caller convention, not something the ABI does.

  • With an empty scope B, both meshes and point clouds are selected from scope A. A scope A that holds only point clouds finds nothing, because no mesh is selected. A mixed scope A still produces both kinds of result.

  • With both scopes empty, a query covers the whole stage in the same additive way: every mesh against every mesh, plus every point cloud against every mesh, subject to OVCLASH_SETTINGS_FLAG_FULL_SCENE.

The legacy encoded-id scope#

ovclash_set_scope(context, stageId, paths1, nbPaths1, paths2, nbPaths2) is the legacy counterpart of ovclash_set_scope_paths. Every path value must come from ovclash_sdf_path_to_int(). Prefer ovclash_set_scope_paths. Apart from this call, only the immediate-mode entry points ovclash_imm_compute_max_local_depth and ovclash_imm_depenetrate_meshes, which compute on two meshes without running a pipeline, take encoded ids. ovstage ignores stageId and uses the context’s open stage.

ovclash_sdf_path_to_int(prim_path, out_encoded) encodes an absolute prim path into an id. Only the backend that produced an id accepts it, and the id stays stable for the process lifetime. Its sharp edges:

  • An id is meaningful only inside the process that produced it. Never persist it, hash it for storage or share it across processes.

  • The registry behind the ids is never pruned, so encoding unbounded distinct paths grows memory until the process exits.

  • The call takes no context, so its return status is the only failure signal.

Reading a transform#

ovclash_get_prim_matrix(context, prim_path, time, out_matrix) writes a row-major 4x4 transform into 16 caller-owned doubles. time is a USD time code, not seconds.

  • The matrix is pre-filled with identity. A call that fails after context validation still leaves a defined matrix.

  • The call fails when the prim does not exist or the read fails. It never substitutes a selected mesh’s pipeline pose.

  • A read or resource failure (not a missing prim) can also invalidate the selection’s result details and the installed pipeline. Recreate and run the pipeline after you address the error.

Reading results#

A successful ovclash_create_pipeline reports at least 7 steps: 11 for a static query (startTime == endTime), otherwise 7 plus one step per sampled time. Run the steps in ascending order with ovclash_run_pipeline_step, or run the whole pipeline with ovclash_run_pipeline_async. Steps carry state, and running them out of order is not diagnosed. A step fails when its phase fails, and the context’s last error names the reason.

#include <ovclash/ovclash.h>
#include <stdio.h>

uint32_t steps = 0;
if (ovclash_create_pipeline(ctx, &steps).status == OVCLASH_STATUS_SUCCESS)
{
    for (uint32_t step = 0; step < steps; ++step)
        ovclash_run_pipeline_step(ctx, step);
}

uint32_t count = 0;
ovclash_get_overlap_count(ctx, &count);
for (uint32_t i = 0; i < count; ++i)
{
    ovclash_overlap_data_t data;
    ovclash_reset_overlap_data(&data);
    if (ovclash_get_overlap_data(ctx, &data, i, 0).status != OVCLASH_STATUS_SUCCESS)
        continue;
    printf("%.*s vs %.*s: %u record(s)\n", (int)data.name0.length, data.name0.ptr,
           (int)data.name1.length, data.name1.ptr, data.nbRecords);
}

In Python, ClashRuntime.run_pipeline() runs every step, and get_overlap_count(), get_overlap_record(index) and get_overlap_details(index) read the results.

What

Canonical entry points

Overlap count

ovclash_get_overlap_count

One overlap record

ovclash_get_overlap_data(ctx, &data, index, recordIndex)

Duplicate meshes

ovclash_get_duplicate_mesh_count, ovclash_get_duplicated_meshes_data, ovclash_delete_duplicate_meshes (a no-op); see Duplicate mesh records

Query statistics

ovclash_get_query_stats, which fills nbMeshes, nbSharedMeshes, nbCookedMeshes and nbPointClouds

Host timeline

ovclash_get_timeline_data: a fixed standalone fallback (all times 0 seconds, timeCodesPerSecond 24) that reflects neither the open stage nor the query settings

Stage timeline

ovclash_get_stage_timeline_data, which reads startTimeCode, endTimeCode, framesPerSecond and the effective timeCodesPerSecond from the open stage’s root layer, with USD fallbacks for unauthored fields. It fails when no stage is open.

Detailed report

ovclash_create_overlap_report, ovclash_create_overlap_report_ex, ovclash_release_overlap_report

Derived values

ovclash_compute_max_local_depth, ovclash_estimate_motion_vector, ovclash_depenetrate_meshes

Memory

ovclash_release_memory, ovclash_is_out_of_memory

The query statistics and the stage timeline come back in these structs:

Field

Type

Required

Default or values

Description

ovclash_stats_t::nbMeshes

uint32_t

Yes

0 or more

The meshes that the run selected.

ovclash_stats_t::nbSharedMeshes

uint32_t

Yes

0 or more

The selected meshes that reuse the cooked data of another selected mesh, so a healthy run cooks nbMeshes - nbSharedMeshes meshes.

ovclash_stats_t::nbCookedMeshes

uint32_t

Yes

0 or more

The unique source meshes that the run cooked.

ovclash_stats_t::nbPointClouds

uint32_t

Yes

0 or more

The point clouds that the run selected.

ovclash_stage_timeline_data_t::startTimeCode

double

Yes

0.0 when unauthored

The stage’s start time code.

ovclash_stage_timeline_data_t::endTimeCode

double

Yes

0.0 when unauthored

The stage’s end time code.

ovclash_stage_timeline_data_t::timeCodesPerSecond

double

Yes

timeCodesPerSecond, else framesPerSecond, else 24.0

The effective stage rate.

ovclash_stage_timeline_data_t::framesPerSecond

double

Yes

24.0 when unauthored

The stage’s frames per second.

A mesh that PhysX cannot cook is dropped from the run instead of failing it. nbCookedMeshes below nbMeshes - nbSharedMeshes means that meshes are missing from the results. The run still succeeds, and ovclash_get_last_error names the count and the first dropped mesh.

ovclash_create_overlap_meshes always fails, and ovclash_release_overlap_meshes does nothing. They exist only for compatibility with the clash interface of Kit; Limitations lists them. Use ovclash_create_overlap_report_ex for faces, outlines and points.

Initializing output structs#

The ovclash_reset_* helpers are the initialization convention of the canonical header. Call one before every call that fills a struct:

Helper

Clears

ovclash_reset_settings

The whole settings table, to the defaults; see Settings

ovclash_reset_overlap_data

Names, hashes, counts, time and minDistance; sets maxLocalDepth to -1.0f and type to OVCLASH_OVERLAP_PAIR_TYPE_UNDEFINED

ovclash_reset_duplicate_mesh_data

Name views, hashes, nbTris and time

ovclash_reset_stats

The four query counters

ovclash_reset_step_data

The name, stepIndex, nbSteps and both progress values; sets finished to true

ovclash_reset_overlap_report

The four counts, pointSize0 and the four buffer pointers, without freeing anything

ovclash_reset_depth_data, ovclash_reset_depenetration_data

Two struct types that no other entry point in the current ABI uses

Two traps in the reset helpers:

  • ovclash_reset_step_data sets finished to true, so finished is not an initialized-or-not test.

  • ovclash_reset_overlap_report never frees. Use it to initialize a report, and release a filled report with ovclash_release_overlap_report.

A reset matters most before ovclash_get_overlap_data, which leaves *data untouched when it fails. Without a reset you cannot tell a filled struct from an unwritten one.

Overlap records#

ovclash_overlap_data_t holds two kinds of data:

  • Constant across all records of a pair: name0, name1, meshHash0, meshHash1, clashHash, nbRecords and type.

  • Specific to one record: nbElements, time, minDistance and maxLocalDepth.

ovclash_get_overlap_data writes every field:

Field

Type

Required

Default or values

Rule

name0

ovclash_string_t

Yes

A prim path

The first prim: the point cloud of a point-vs-mesh pair, else a mesh. Borrowed from the context.

name1

ovclash_string_t

Yes

A prim path

The second prim, a mesh. Borrowed from the context.

meshHash0, meshHash1

uint64_t[2]

Yes

Two 64-bit words

The mesh hash of each mesh’s data.

clashHash

uint64_t[2]

Yes

Two 64-bit words

The clash hash, a hash of the two prim paths.

nbRecords

uint32_t

Yes

1 or more

The number of frames in which the pair overlaps. Always 1 for a static query.

type

uint32_t

Yes

An ovclash_overlap_pair_type_t: 0 mesh-vs-mesh, 1 point-vs-mesh, 0x7fffffff undefined

The pair type.

nbElements

uint32_t

Yes

0 or more

The overlapping triangles or points in this frame.

time

double

Yes

Seconds

Multiply it by the stage’s effective time-codes-per-second rate to get a USD time code.

minDistance

float

Yes

0 or more

The minimum distance between the pair’s triangles, in stage units, so the stage’s metersPerUnit applies. 0 when they touch or interpenetrate.

maxLocalDepth

float

Yes

-1.0f, or 0 or more

In stage units. -1.0f means “not computed”. A mesh-vs-mesh overlap stays there unless ovclash_set_compute_max_local_depth selected a mode above DISABLED (the default). Once computed, it is never negative. A point-vs-mesh overlap always reports 0.0f, in every mode, because depth is mesh-only.

Duplicate mesh records#

ovclash_get_duplicated_meshes_data(ctx, &data, index) fills an ovclash_duplicate_mesh_data_t for an index below the count that ovclash_get_duplicate_mesh_count reports. It writes *data only on success, so initialize the struct with ovclash_reset_duplicate_mesh_data first.

Field

Type

Required

Default or values

Description

name0, name1

ovclash_string_t

Yes

Prim paths

The two meshes of the pair. Borrowed from the context: the next pipeline run, ovclash_release_memory, ovclash_reset_context, ovclash_release_context and a new stage invalidate them.

meshHash0, meshHash1

uint64_t[2]

Yes

Two 64-bit words, equal for a genuine duplicate pair

The mesh hash of each mesh’s data.

clashHash

uint64_t[2]

Yes

Two 64-bit words

The clash hash, a hash of the two prim paths.

nbTris

uint32_t

Yes

0 or more

The number of triangles in the duplicated mesh.

time

double

Yes

Seconds

The time of the pair on the timeline.

Overlap reports#

The two creators honor different OVCLASH_OVERLAP_REPORT_FLAG_* bits:

Function

Honors

Notes

ovclash_create_overlap_report

_DEFAULT, _FACES, _OUTLINE

It ignores _FACES0, _FACES1 and _POINTS0. meshIndex chooses whose face indices land in collidingFaces0; collidingFaces1 stays empty. Point-cloud overlaps fail.

ovclash_create_overlap_report_ex

_FACES0, _FACES1, _OUTLINE, _POINTS0

It ignores the legacy _DEFAULT and _FACES bits. It also writes the two prims’ world matrices.

Both creators fill an ovclash_overlap_report_t. They fill only the fields that the flags select, so initialize the struct with ovclash_reset_overlap_report first.

Field

Type

Required

Default or values

Description

nbCollidingFaces0, collidingFaces0

uint32_t, const uint32_t*

With _FACES, _FACES0, or flags 0 on ovclash_create_overlap_report

Face indices of the USD mesh

The colliding faces of the first mesh, or of the mesh that meshIndex chooses.

nbCollidingFaces1, collidingFaces1

uint32_t, const uint32_t*

With _FACES1

Face indices of the USD mesh

The colliding faces of the second mesh.

nbCollidingSegments, collidingSegments

uint32_t, const ovclash_segment_t*

With _OUTLINE

Segments of two ovclash_float3_t points, p0 and p1

The intersection outline. Only touching or interpenetrating triangle pairs add segments.

nbCollidingPoints0, collidingPoints0

uint32_t, const uint32_t*

With _POINTS0

Point indices of the USD point cloud

The clashing points of a point-vs-mesh overlap.

pointSize0

float

With _POINTS0

0.0 or more

The point diameter for collidingPoints0, from the first source that applies in the pointSize0 list of Overlap reports.

matrixData0 and matrixData1 on _ex are output buffers. When one is non-null, the callee writes the transform captured at that record into it: exactly 16 doubles, a row-major 4x4 matrix. Each non-null pointer must therefore point at storage for 16 doubles. The identically named const double* parameters of ovclash_imm_compute_max_local_depth and ovclash_imm_depenetrate_meshes are inputs.

Every pointer in a report is borrowed; the caller never owns it. Release the report before the next pipeline step or run, ovclash_release_memory, ovclash_reset_context or ovclash_release_context. A sampled step can replace borrowed result buffers within the same run, and a pointer you already copied out cannot be checked for staleness afterwards.

pointSize0 accompanies _POINTS0. It is the first of these that applies:

  1. a positive explicit ovclash_set_point_size value;

  2. a single authored USD width;

  3. per-point widths;

  4. an automatically computed size.

It never includes the prim’s transform scale. With per-point widths, it is the common width when every entry is equal and positive, otherwise 0.0. On 0.0, read the widths from USD by the point indices in collidingPoints0.

Overlap index order is not contractual#

Note

The overlap-group index passed to ovclash_get_overlap_data is an identifier, not a rank. Runs over the same stage with the same settings report the same groups with the same data, but not necessarily in the same order. Key on name0/name1 or clashHash, and sort in the consumer when you need a fixed sequence.

The contract covers:

  • the overlap count and the duplicate-mesh count;

  • the set of overlapping pairs;

  • each pair’s nbElements, nbRecords, type, minDistance and maxLocalDepth;

  • the report payloads.

ovstage returns one canonical mesh-path order under every threading setting, but that order is not part of the contract either. The same rule holds in both Python packages.

To get a stable sequence, sort in the consumer:

from ovclash import ClashRuntime

with ClashRuntime() as runtime:
    runtime.open_stage("time_sampled.usda")
    runtime.run_pipeline()
    records = [runtime.get_overlap_record(index) for index in range(runtime.get_overlap_count())]

# The index order is not contractual: sort by pair names for a stable sequence.
for record in sorted(records, key=lambda record: (record.name0, record.name1)):
    print(record.name0, record.name1, record.nb_elements)

time_sampled.usda ships in samples/data/; run the program from there, or pass the stage’s full path.

What results are stable#

For the same stage, settings and package version, these parts of a result repeat exactly:

  • The overlap set. The count, the duplicate-mesh count, the set of pairs and each pair’s data and report payloads, as Overlap index order is not contractual lists. The overlap index is an identifier, not part of that set.

  • Threading. single_threaded, new_task_manager and nb_tasks never change the overlap set. A difference in it between threading settings is a defect.

  • Sample times. A run of a dynamic query computes its sample times with one recurrence, in binary64 arithmetic. The first sample is exactly the start time. Each next time is the previous time plus 1.0 / rate, and sampling stops when the next time exceeds the end time. There is no endpoint clamp, so rounding can exclude an end time that lies on the grid in real arithmetic. A zero rate, or an end time below the start time, gives one sample at the start time. The number of samples, and with it the step count and the largest possible nbRecords, follows from the same recurrence.

  • Exports. JSON and HTML exports with identical ordered columns, cell values and metadata are byte-identical.

  • Stored records. A database overlap cursor returns overlaps ordered by overlap_id, the hex form of the pair’s clashHash, then by record identifier. A frame cursor returns frames by time, then by record identifier.

These parts are not stable:

  • The overlap index order; see Overlap index order is not contractual.

  • SQLite file bytes. Timestamps, user metadata, fresh row identifiers, page layout and transaction history differ between two stores with the same results. Compare stores by their records, not by their bytes.

This Python function reproduces the sample times of a dynamic run:

def sample_times(start: float, end: float, rate: float) -> list[float]:
    """Return the sample times of a dynamic query from start to end at rate samples per second."""
    step = float("inf") if rate == 0.0 else 1.0 / rate
    times = [start]
    current = start
    while current + step <= end:
        current += step
        times.append(current)
    return times


print(sample_times(0.0, 0.3, 10.0))  # [0.0, 0.1, 0.2]
print(sample_times(0.0, 1.0, 0.0))  # [0.0]

The first call shows the missing endpoint: the third addition gives 0.30000000000000004, which exceeds 0.3. Both Python packages reject an end time below the start time; the canonical C ABI accepts it.

Error text#

Both C ABIs catch C++ exceptions before they cross the boundary. A failed call returns an error status and usually records its reason as last-error text. The Python packages raise with that text; see Python exceptions.

Channel

Scope

ovclash_get_last_error(context)

Per context; the only diagnostic channel of the canonical C ABI

ovclash_suite_get_last_error(runtime)

Per Suite runtime handle, falling back to the thread-local text

ovclash_suite_data_get_last_error(data)

Per Suite data handle, falling back to the thread-local text

ovclash_suite_get_thread_last_error()

Per thread, for handle-free and generic errors

ovclash_suite_fetch_async_get_last_error(async, &error)

Per async fetch operation

The context error text is sticky across most successful calls. Read it immediately after a call returns OVCLASH_STATUS_ERROR. Never treat a non-empty string as proof that the last call failed. An empty string does not prove success either, because some rejections record nothing:

  • a null context;

  • some null arguments, for example a null struct passed to ovclash_set_settings;

  • any ovclash_get_settings failure;

  • a step rejected for pending cancellation.

The context-free entry points, such as ovclash_sdf_path_to_int and the ovclash_reset_* helpers, never record anything. Check the status. Error text lifetime lists the calls that clear the text and how long each channel’s text stays valid.

Python exceptions#

  • Native failures generally become RuntimeError carrying the native error text:

    try:
        runtime.open_stage("missing.usda")
    except RuntimeError as error:
        print(error)  # Failed to open stage 'missing.usda': Failed to open USD stage: missing.usda
    
  • Some legacy data-facade methods keep their old return values (False, 0, None, {} or []) instead of raising. Failures that do not raise lists them. ClashQuery.load_settings_from_str() also returns False for empty or invalid JSON, while ovclash_suite_query_load_settings_json() reports OVCLASH_SUITE_STATUS_ERROR for it.

  • Explicit cleanup methods, such as ClashRuntime.destroy() (alias close()) and ClashDetection.destroy(), raise RuntimeError when the native release fails. They keep the handle for a retry.

  • Importing either package raises OSError when the native library cannot be loaded, and RuntimeError when the library’s version differs from the package’s.

Environment variables#

This section lists every environment variable that a consumer of the wheel or the SDK archive can set. A flag is enabled by any value other than empty, 0, false, off or no; the comparison ignores case and surrounding whitespace.

Loading the library#

The Python packages read these variables when they load the native library.

Variable

Values

Required

Default

Effect

OVCLASH_SUITE_LIB, OVCLASH_LIB

The absolute path of the native library

With the SDK archive’s Python packages

Unset: the packages load the library that the wheel bundles

Selects the native library to load. OVCLASH_SUITE_LIB is checked first. A relative path raises OSError.

OVCLASH_ALLOW_BARE_LIBRARY_LOAD

Flag

No

Off

For development only. Lets the loader fall back to a platform bare-name library lookup when neither override is set and no bundled library exists.

OVCLASH_DLL_DIRS

Directories separated by ;

No

Unset

Windows only. Extra DLL search directories.

OVCLASH_DISABLE_BUNDLED_PLUGIN_PATHS

Flag

No

Off

Stops the loader from adding the runtime’s OpenUSD plugin directories to OV_PXR_PLUGINPATH_2511 and PXR_PLUGINPATH_NAME, and on Windows the payload’s plugin directories to the DLL search path. Set it when another component owns OpenUSD plugin isolation; see USD coexistence.

OVCLASH_OVSTAGE_PACKAGE_DIR

The absolute path of an installed ovstage package directory, whose parent holds ovstage-<pin>.dist-info

No

Unset: the selected interpreter’s ovstage

SDK archive only; the wheel and its launchers ignore it. Selects that installation instead of the interpreter’s. The Python bindings and the sample launchers read it, and find_package(ovclash) reads it as an environment or CMake variable. With it set, the SDK archive’s sample launchers never prepare a cached environment. A relative path is rejected, and a package that is not the pinned version fails with an error that names the variable.

OVSTAGE_LIBRARY_PATH_HINT

A directory path

No

Unset: with the wheel, the loader sets it to the runtime it found

Read by the ovstage package to find its runtime. With the wheel, the loader keeps a value you set. With the SDK archive, the loader replaces any inherited value with the directory of the ovstage it selected and checked.

Runtime behavior#

The native library reads these variables itself, so they apply to C and C++ programs as well as to the Python packages.

Variable

Values

Required

Default

Effect

OVCLASH_OMNI_CLIENT_RETRY_MAX_MS

Milliseconds, an unsigned 32-bit decimal integer

No

0: fail at once

How long the runtime’s omni client, the Omniverse client library inside ovstage, keeps reconnecting to an unreachable omniverse:// host while a stage is populated. The default makes assets on that host fail at once. ovclash applies it once per process, when it first finds the runtime’s omni client. The client is process-global, so the value applies to every caller that shares it. An invalid value is reported on stderr and treated as 0. See Troubleshooting.

OVCLASH_SOURCE_PERF

1; any other value counts as unset

No

Unset: off

Exactly 1 turns on timing diagnostics: [source-perf] begin and end lines on stdout for the phases of ovstage stage reading, and one [fetch-perf] summary line on stderr when each Suite fetch-and-save operation is destroyed. It is read once per process. The line format is not a stable interface. See Collecting diagnostics for a bug report.

Sample launchers and build_samples#

The shipped sample launchers read these variables; a command-line option wins over its variable. Samples describes the launchers.

run_custom_clash is the launcher of The Clash Processor. Outside an SDK archive, or with --wheel, it takes the published-wheel route unless --install-root names an SDK archive: it installs the published ovclash wheel into its own virtual environment and runs the processor there.

Variable

Values

Required

Default

Effect

PYTHON

An interpreter name or path

No

python3 on Linux, python on Windows

The base interpreter of the sample launchers, run_custom_clash and build_samples. With the SDK archive or the wheel, the sample launchers and build_samples use it when the exact pinned ovstage is available to it, including one installed beside the wheel; an ovstage beside the wheel that is not the pin is an error. Otherwise they install that pin into a per-user cached virtual environment and use that environment for the run and, in build_samples, for CMake. They ignore an inherited PYTHONPATH, and the base interpreter’s packages stay unchanged. The published-wheel route of run_custom_clash creates its virtual environment from it.

LOCALAPPDATA (Windows), XDG_CACHE_HOME (Linux)

An absolute directory path

No

~/AppData/Local on Windows, ~/.cache on Linux

The per-user cache root. The cached sample environments live under ovclash/samples/python there.

OVCLASH_BACKEND

A backend name; the released packages hold only ovstage

No

Unset: the packaged samples/ovclash_backend.txt

The default backend of the clash_api and clash_suite_api launchers and of run_custom_clash. The --backend option overrides it, and so do --openusd and --ovstage where a launcher offers them. It has no effect on a library that is already loaded.

OVCLASH_INSTALL_ROOT

A directory path

No

Unset: the package that holds the launcher

The runtime or SDK archive root for the sample launchers, run_custom_clash and build_samples, like --install-root DIR.

OVCLASH_SAMPLE_CONFIG

Release or Debug

No

Release

Windows launchers only. The default --config of the run_<sample>_python.bat and run_<sample>_cpp.bat launchers.

OVCLASH_CLASH_API_STAGE, OVCLASH_CLASH_SUITE_API_STAGE

A USD file path

No

samples/data/time_sampled.usda

The default --stage of the clash_api and clash_suite_api launchers.

OVCLASH_CLASH_API_OUTPUT_DIR, OVCLASH_CLASH_SUITE_API_OUTPUT_DIR, OVCLASH_LEGACY_CLASH_DETECTION_OUTPUT_DIR

A directory path

No

A directory inside the package root; see Output directories

The default --output-dir DIR of each sample’s launchers. Only the Linux launchers read the legacy_clash_detection variable.

OVCLASH_INDEX_URL

A package index URL

No

Unset: pip’s own configuration selects the index

run_custom_clash only. The published-wheel route passes it to pip as --index-url when it creates its virtual environment. The index must serve ovclash and its pinned ovstage.

OVCLASH_VERSION

An ovclash version

No

The latest version

run_custom_clash only. The ovclash version that the published-wheel route installs. A working environment is reused and never repinned; delete .venv-ovclash beside the script to install another version.

OVCLASH_PROCESSOR

A Python script path

No

clash_suite_api_python.py beside the launcher

run_custom_clash only. The processor script of the published-wheel route.

OVCLASH_SAMPLE_BUILD_ROOT

A directory path

No

Windows SDK archive: a per-user cache under %LOCALAPPDATA%\ovclash\samples; Linux: inside the extracted SDK archive

SDK archive only. The parent of the C++ sample build trees, like build_samples --build-root DIR; a relative path is anchored to the SDK archive root. On Windows, %TEMP% replaces %LOCALAPPDATA% when LOCALAPPDATA is unset, and the cache keeps compiler paths short; when that cache cannot be selected, the build runs inside the extracted SDK archive. Set it when that location is not writable, for example for an SDK archive extracted to a read-only directory.

CMAKE

An executable name or path

No

cmake on the search path

SDK archive only. The CMake executable of build_samples.

BUILD_TYPE

Release or Debug

No

Release

SDK archive only, Linux. The default --config of build_samples.

OVCLASH_OVX_INCLUDE_DIR, OVCLASH_PYTHON_EXECUTABLE

A directory path; an absolute interpreter path

No

Discovered; the selected interpreter

SDK archive only. Read by build_samples and find_package(ovclash). CMake variables describes them.

OVCLASH_OVSTAGE_ROOT

A directory path

No

Unset

SDK archive only. When OVCLASH_OVX_INCLUDE_DIR is unset, find_package(ovclash) searches <OVCLASH_OVSTAGE_ROOT>/include for the ovx headers. It is a header-search hint only and never selects the ovstage runtime.

When a launcher installs the ovstage pin into its cached environment, pip’s own configuration applies, including PIP_* variables such as PIP_INDEX_URL.

Two names look like backend switches and are not:

  • OVCLASH_BACKEND only presets the --backend option of the sample launchers.

  • ovclash_suite.ClashDetection(backend=...) accepts "ovclash", "suite" and "legacy", and raises ValueError for any other value. It is a compatibility name for the Suite object model. The loaded library determines the backend; backend_info() reports it.

Persistence and export#

The Suite API’s stores and exports have their own pages:

One rule applies to every write on a built-in store. A write that fails after its storage write began rolls back every write pending on that data handle, including earlier writes that returned success. Commit before a write that may fail when the earlier writes must survive.