Skip to content

[POC] Add Isaac Sim viewer visualizer with a shared OVStage - #8907

Draft
matthewtrepte wants to merge 16 commits into
isaac-sim:mainfrom
matthewtrepte:mtrepte/is7-shared-ovstage
Draft

matthewtrepte wants to merge 16 commits into
isaac-sim:mainfrom
matthewtrepte:mtrepte/is7-shared-ovstage

Conversation

@matthewtrepte

@matthewtrepte matthewtrepte commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Initial proof of concept for using the Isaac Sim 7 viewer application as an Isaac Lab visualizer (--viz isaac-sim): Isaac Lab keeps its own physics and loop, and Isaac Lab and the viewer share one OVStage as their data layer. This is early, experimental work to evaluate the architecture and performance.

  • Add the isaac_sim visualizer backend (IsaacSimBackendCfg), which runs the Isaac Sim 7 application host in-process and opens its Electron window (viewport, stage tree, properties, content browser, transport controls).
  • The host's stage context registers the OVStage; Isaac Lab populates it through its clone plan and native ovstage_replicate, then owns its ordinals. Each frame it writes body poses and markers, applies the host's queued commands (camera, viewport, property inspection, edits), seals, and renders the viewer with OVRTX.
  • The host runs no scheduler: Isaac Lab drives every update. The viewer's Play, Pause, Step and Stop gate Isaac Lab's loop (Stop resets the environments), so the viewer mainly provides frame output, input back to Isaac Lab, its panes, and editing features such as selection.
  • The property pane describes cloned prims by their source prim (read-only) and shows live world poses from the shared stage.
  • Camera controls default to the Newton viewer's bindings (left-drag looks, middle-drag orbits, Shift/Ctrl+middle pan/dolly); camera_controls="isaac_sim" keeps the client's Kit-style bindings.

Type of change

  • New feature (proof of concept)

Screenshots

g1_rough_isaac_sim_viz.mp4

G1 rough terrain, 512 envs, pretrained policy:

G1 rough terrain, 1024 envs, RSL-RL training, Newton MJWarp, 60 iterations (throughput averaged over iterations 5–59), with each viewer window open on a live display:

Visualizer Startup Steps/s Iteration time vs. headless GPU util (mean / max) GPU memory
Headless 49.4 s 34.0k 0.73 s — 40% / 66% 2.8 GB
--viz isaac-sim 99.8 s 15.9k 1.55 s −53% 39% / 62% 8.6 GB
--viz kit 116.5 s* 9.9k 2.49 s −71% 24% / 41% 6.3 GB
--viz newton 68.1 s 9.1k 2.71 s −73% 69% / 87% 3.8 GB

* Kit ran in an Isaac Sim 6.1 environment; the other rows ran in the Isaac Sim 7 environment. Both use Isaac Lab's pinned Newton. Repeating the visualizer runs with the display off changed throughput by at most 4%.

Validation

  • Rendering verified with body poses matching Isaac Lab exactly: Cartpole, Ant, Humanoid, H1 flat, G1 rough, Go2 rough at 512 envs; Cartpole and Go2 at 4096.
  • Heterogeneous environments (Lift-Franka multi-asset objects) populate correctly.
  • Transport controls: Pause holds Isaac Lab's loop, Step advances exactly one step, Play resumes, Stop resets the environments.
  • Property pane: typed attributes for source and cloned prims, live world poses for bodies and their children.
  • test_isaac_sim_visualizer.py and launcher/preset tests pass.

Limitations

  • Requires Isaac Sim 7 7.0.0a2.dev55385 with ovstage 0.4, ovphysx 0.8 and ovrtx 0.7.dev (Isaac Lab pins ovstage 0.3), sim_viewer on PYTHONPATH, and a built viewer client.
  • Startup is about 30 s slower than --viz newton at 1024 envs (export, stage population, OVRTX setup, application host), and the gap grows with the number of environments.
  • Markers do not animate: OVRTX ignores runtime point-instancer updates.
  • Renders are serialized with stage writes, capping the viewer near 50 fps; the camera only moves on Isaac Lab steps.
  • Uses the most GPU memory of the visualizers (8.6 GB at 1024 envs, against 3.8 GB for --viz newton).
  • Property-pane velocities show authored values, not live ones; cloned prims are read-only there.
  • Tested with Newton MJWarp only; no CPU device support.
  • Relies on private Isaac Lab and Isaac Sim pieces: SceneCommands._capture_activation / _published, a World subclass, no-op stand-ins for the host's scheduler calls, and a patched copy of the client's camera bindings.
  • Viewer requests that touch the GPU during Isaac Lab's first physics step can break Newton's CUDA graph capture; this needs a guard.

Extensions

  • Isaac Sim: an application-host world driven by an external owner (public replacements for the private pieces above), adopting an existing OVStage, AuthoringSession from an in-memory stage, and configurable camera bindings in the client.
  • OVRTX: runtime point-instancer updates, and writes at a new ordinal while a render reads an older one.
  • Host API to publish CUDA frames (GPU presentation instead of CPU readback).
  • OVPhysX: physics already on OVStage, so poses need no copy.
  • Package the viewer client and dependencies; add tests and docs.

Checklist

  • I have read and understood the contribution guidelines.
  • I have run the formatting and lint checks.
  • I have made corresponding changes to the documentation (proof of concept; setup notes are in the package docstring).
  • I have added changelog fragments for the affected packages.
  • My name already exists in CONTRIBUTORS.md.

Show an Isaac Lab simulation in the Isaac Sim 7 viewer without using Isaac
Sim physics or rendering backends. Isaac Lab keeps stepping its own physics
(for example Newton MJWarp) and publishes world poses from the scene data
provider straight into the viewer's OVStage through DLPack, the same
zero-copy path the OVRTX renderer uses. The OVGL renderer then draws the
frame.

The scene is exported from the authored USD stage into an Isaac Sim 7
simulation context, so every environment is authored with UsdReplicateContext.
All dependence on Isaac Sim 7 internals sits in is7_stage.py: adoption of the
context's native stage pointer and write-ordinal handling.
Run the Isaac Sim 7 application host in-process with a physics-free world, so the
viewer shows the stage tree, properties, content browser and picking while Isaac Lab
keeps its own loop and physics. Poses go through the host's command queue.
Port the IS7 visualizer to the split visualizer configuration: backend options live in
IS7BackendCfg, while viewport size, host rate and headless come from VisualizerCfg.
Register an Isaac Lab pose engine with the Isaac Sim 7 host. It writes body world
matrices and the transform journal at the host's output ordinal before rendering, so
the OVGL renderer refreshes only the journaled bodies: 4x the viewer frame rate at 256
cartpole envs and 16x at 1024. The command-queue path stays selectable.
Add stage_mode="shared" (now the default) to the Isaac Sim 7 viewer visualizer,
selected with --viz isaac-sim. The host's stage context creates and registers one
OVStage; Isaac Lab borrows it, populates the environments through its clone plan,
and owns the ordinals: each frame it writes body poses and visualization markers,
runs the host's participants through a Python stand-in for the host
orchestration, seals, and renders the viewer's products with OVRTX. The host
reads the same stage for its stage tree and property panes and streams the frames.

Rename the visualizer type to isaac_sim and accept hyphens for underscores in
--viz and preset names.

Go2 rough terrain, 512 envs, RSL-RL: 12.2k env steps/s with the viewer open,
against 6.2k with the Newton visualizer and 19.4k headless.
@matthewtrepte
matthewtrepte requested a review from a team November 3, 2026 02:00
@github-actions github-actions Bot added the isaac-lab Related to Isaac Lab team label Nov 3, 2026
Match the --viz isaac-sim name in code: isaaclab_visualizers.is7 becomes
isaaclab_visualizers.isaac_sim, with IsaacSimBackendCfg and IsaacSimVisualizer
and the ISAACLAB_ISAAC_SIM_APP_CLIENT_ROOT environment variable.
@greptile-apps

greptile-apps Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 3/5

[Medium impact] The PR adds an opt-in viewer path that changes how one simulation workflow is displayed and controlled.

Fix the no-body rendering failure and the outstanding marker-material failure before merging.

Findings

  1. P1 Static scenes never render ▶
  2. P1 Marker materials can stop training ▶
  3. P2 Camera settings are ignored ▶
  4. P2 Environment limits are ignored ▶
  5. P2 Removed viewports return ▶

Summary

Adds an experimental Isaac Sim 7 viewer backed by a shared OVStage.

  • Isaac Lab accepts isaac-sim as a visualizer choice.
  • Isaac Lab and the viewer render from one shared OVStage.
  • The Isaac Sim viewer’s transport controls steer Isaac Lab’s simulation.
  • Isaac Lab visualization markers appear in the shared viewer stage.
  • The viewer camera can use Newton-style mouse controls.

matthewtrepte explicitly lists unpackaged dependencies, no CPU support, non-animated markers, and GPU requests during the first physics step as known limitations.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    A[Isaac Lab physics] --> B[Write body poses and markers]
    C[Viewer commands] --> D[Apply queued commands]
    B --> D
    D --> E[Seal shared OVStage]
    E --> F[OVRTX renders frames]
    F --> G[Host streams frames]
    G --> H[Viewer client]
    H --> C
Loading

Reviews (2) · Last reviewed commit: "Merge remote-tracking branch 'upstream/m..." · Reviewed by Greptile

Comment on lines +43 to +47
if material is not None and material_path is not None:
# File spawners apply a separate material only with Kit; the material itself is plain UsdShade.
if not material_path.startswith("/"):
material_path = f"{prim.GetPath()}/{material_path}"
material.func(material_path, material)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Marker materials can stop training

_instancer_usd creates a material again even when the marker spawner already created it. A shape marker with an absolute visual_material_path creates that material inside cfg.func; the second call to material.func then raises ValueError. This escapes the viewer step and stops training.

Only add the fallback material for spawners that skipped it, and check whether the material already exists.

Comment on lines +113 to +121
self._provider = sim.get_scene_data_provider()
self._paths = list(self._provider.backend.transform_paths)
self._scales = authored_scales(sim.stage, self._paths)
started = time.perf_counter()
replication = None
if self.backend_cfg.stage_mode == "shared":
scene, replication = self._export_prototypes(sim)
else:
scene = self._export_scene(sim.stage)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Environment limits are ignored

IS7Visualizer ignores the environment selection computed by BaseVisualizer. Both export paths include all environments, and pose publication uses every transform_paths entry. Users who set --max_visible_envs or visible_env_indices still see the full scene and pay to render it.

Apply the selection to the viewer stage, or reject these settings until supported.

Comment on lines +204 to +209
def register(view: Any) -> None:
cloned.result()
view.write([spec.product], "resolution", np.asarray([spec.resolution], dtype=np.int32))
with lock:
renderer.add_product(spec.product)
ready.add(spec.product)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Removed viewports return

The queued register callback can undo a later remove_viewport call. Removal drops the product immediately, but the pending callback adds it back without checking whether the viewport is still wanted. That can leave the renderer tracking a removed product.

Keep a desired-product set and check it under the same lock before writing or registering, as the export path already does.

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isaac Lab Review Bot

Needs attention: Design and architecture (1), Scope and over-engineering (2), Implementation (4), Style consistency (2), Test quality (1). Other reviewed categories look good.

  • PR description: Replace stale IS7BackendCfg/test_is7_visualizer.py names and the unattached-video placeholder; for throughput/FPS claims, add the command, hardware, warmup, and measured revisions, retaining the stated MJWarp and 512-environment scope.
  • Design and architecture: The shared-stage path depends on isaaclab_ov’s private _prepare_scene_copies contract; expose and consume a supported replication API instead.
  • Scope and over-engineering: Minimal implementation: extend sim_launcher, presets, scene-data registration, and the visualizer package; keep init, isaac_sim_visualizer_cfg, isaac_sim_visualizer, isaac_sim_shared_stage, isaac_sim_shared_world, isaac_sim_shared_markers, and isaac_sim_external_simulation; merge isaac_sim_stage into the visualizer; delete isaac_sim_world and isaac_sim_poses with export mode, pose transport, and global hyphen normalization. Replace with one smaller PR: shared-OVStage registration and lifecycle, validated at launcher, scene-population, marker-next-frame, and teardown boundaries.
  • API: API changes look good.
  • Compatibility and deprecation: No breaking changes identified.
  • Implementation: SharedStage.close drops its owned UsdContext without closing it, leaking the native context and registered stage; close it after destroying the borrowed stage.
  • Style consistency: The new public package hand-rolls lazy exports instead of using lazy_export with an adjacent init.pyi; adopt the required package pattern.
  • Test quality: Keep the instance-expansion boundary test, but remove the registration test because it only repeats three newly added literals without exercising dispatch.

Significant concerns. Posted 10 inline findings.

Automated review; human maintainers own approval decisions.

* ``name`` is itself a real field in ``known_names`` (a user-defined preset
legitimately reusing the deprecated spelling shadows the alias).
"""
if name not in known_names and name.replace("-", "_") in known_names:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Scope Complexity — Hyphen aliasing added to all presets

This fallback accepts hyphenated spellings for every preset group, and sim_launcher.py:220 duplicates it, solely so --viz isaac-sim resolves. Use the snake_case selector like the other visualizers and drop both hunks.

__all__ = ["IsaacSimBackendCfg", "IsaacSimVisualizer"]


def __getattr__(name: str):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Style Consistency — Export module bypasses lazy_export pattern

The contribution guide requires public export modules to call lazy_export() with an adjacent init.pyi declaring all. This hand-rolled getattr duplicates that mechanism and leaves no stub for type checkers.

)
self._pending.add(group_id)
added = True
elif group_id in self._pending:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Implementation — New marker groups skip a write

The pending branch only clears the flag, so a group's state is first written two syncs after creation, not "the next one" as the method docstring promises. Write the group here.

self._queries.clear()
self.stage.destroy()
finally:
self.context = None

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Implementation — Shared stage context is never closed

close() only drops the reference to the UsdContext created in init, and BorrowedContext.close() deliberately no-ops, so the native context and registered stage outlive teardown. Close it after destroying the borrowed stage.

class IsaacSimVisualizer(BaseVisualizer):
"""Isaac Sim 7 viewer application driven by Isaac Lab's simulation.

The Isaac Sim 7 host owns the stage, renderer and UI (stage tree, properties, content browser, picking and

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Style Consistency — Class docstring describes non-default mode

This states the host owns the stage and receives poses through its command queue, but the default stage_mode="shared" writes and seals an OVStage here; isaac_sim_visualizer_cfg.py:23 repeats the mismatch.

super().__init__(cfg)
self.backend_cfg: IsaacSimBackendCfg = cfg.backend
if self.backend_cfg.app_client_root is None:
self.backend_cfg.app_client_root = os.environ.get("ISAACLAB_ISAAC_SIM_APP_CLIENT_ROOT")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Implementation — Constructor mutates caller-owned backend config

Writing the environment value into cfg.backend mutates a config the preset hands out, so to_dict() and reuse observe a path the user never declared. Store the resolved root on the instance.

def extra_participants(wake):
return [NativeParticipant("isaaclab-poses", engine.participant(rate), PHYSICS_POSITION)]

open_world = make_physics_free_world_opener(specs, rate, renderer="ovgl", extra_participants=extra_participants)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Implementation — Unused world opener built in shared mode

In the default stage_mode="shared", this opener and renderer_name are overwritten at lines 156 and 165, but constructing it still imports the vendored host module. Select the opener in one branch.

stage = sim.stage
plan = sim.get_clone_plan()
if plan is not None and len(plan.topology.world_prototype_layout) > 1:
from isaaclab_ov.cloner.replicate import _prepare_scene_copies

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Design Architecture — Depends on private isaaclab_ov cloner helper

_prepare_scene_copies is private to isaaclab_ov.cloner.replicate and is driven through an undocumented SimpleNamespace out-parameter, so refactoring it silently breaks this backend. Expose a public replication entry point instead.

port: int = 0
"""Port of the host's HTTP service; zero picks a free one."""

stage_mode: Literal["export", "shared"] = "shared"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Scope Complexity — Export stage mode is parallel subsystem

stage_mode="export" and pose_transport pull in isaac_sim_world.py (288 lines vendored from sim_viewer) and isaac_sim_poses.py, neither used by the shared-stage feature this PR claims. Delete them and the second pose path.

"""


def test_isaac_sim_is_registered():

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning · Test Quality — Registration test restates added constants

These assertions mirror the VISUALIZER_TYPES, REQUIRES_STAGE_AND_MODEL and visualizer_type literals added in this diff and exercise no dispatch, so they cannot fail for a product reason. Remove the test.

The shared OVStage covers the export mode's use and scales further, so drop
stage_mode, pose_transport and deinstance_max_points, the host pose engine and
the OVGL world opener. A scene without cloned environments is exported whole
through the same path.
Replace the scheduler stand-in with a host adapter: Isaac Lab drains the viewer's command queues each frame, Pause and Step gate its loop, and Stop requests an environment reset. Drop live property inspection, which needs Isaac Sim physics views.
Follow Isaac Sim's viewport_direct example: a Viewer driven from Isaac Lab's thread with no host world or scheduler, serving Isaac Lab's OVRTX frames through a small viewport adapter. Make it the default and keep the application host as host="app". Note the open points for the Isaac Sim team in the module docstring.
Isaac Lab still drives every update; the direct viewer stays available as host="viewer" for a viewport-only window.
Describe cloned prims by their source prim, read-only, since clones exist only in the shared stage. Restore property inspection with live world poses read from the stage; Isaac Sim's own inspection needs native views and Isaac Sim physics.
Serve a copy of the client's shared renderer with its camera bindings changed to match the Newton viewer: left-drag looks, middle-drag orbits, Shift and Ctrl with the middle button pan and dolly. Fall back to the client's own bindings if this client version does not match.
The viewport-only mode lacked the stage, property and content panes and transport controls; the application host, driven by Isaac Lab, is the only mode.
Grant viewer Steps only while paused, reset only on Stop and not when the host reloads authored edits, look cloned prims up by their source first, keep the stock camera controls when the client lacks the expected module, write the transform-stack reset before marking it done, and require the client root before any startup work.
# Conflicts:
#	source/isaaclab/isaaclab/app/sim_launcher.py
#	source/isaaclab_tasks/isaaclab_tasks/utils/presets.py
@matthewtrepte

Copy link
Copy Markdown
Collaborator Author

run-ci

@matthewtrepte

Copy link
Copy Markdown
Collaborator Author

@greptileai review

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Nov 20, 2026
Comment on lines +250 to +251
if not self._provider.get_transforms(self._pose_output, allow_passthrough=True, scales=self._scales):
return

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Static scenes never render

_render_frame returns before calling self._shared.step when the scene has no rigid-body transforms. Empty scenes, static scenes, and particle-only scenes therefore never drain viewer commands or render a frame. Keep stepping the shared stage when no body poses are available; skip only the pose writes.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

open_world=self._shared,
scene=str(scene),
viewports=specs,
viewport_factory=lambda index: dynamic_viewport_spec(index, tuple(self.cfg.window.size)),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Camera settings are ignored

IsaacSimVisualizer never applies eye, lookat, or focal_length to the viewer cameras. super().initialize skips perspective cameras for this backend, and dynamic_viewport_spec receives only the window size. Existing task camera settings are silently lost, such as Cartpole's eye=(8.0, 0.0, 5.0), so users must reposition the camera themselves. Apply the configured pose and lens when creating each viewport.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant