Skip to content

Make preview surfaces renderer agnostic - #7189

Merged
kellyguo11 merged 4 commits into
isaac-sim:developfrom
maxkra15:fix/preview-surface-renderer-agnostic
Aug 20, 2026
Merged

kellyguo11 merged 4 commits into
isaac-sim:developfrom
maxkra15:fix/preview-surface-renderer-agnostic

Conversation

@maxkra15

@maxkra15 maxkra15 commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Author PreviewSurfaceCfg and visual-material bindings with standard OpenUSD APIs so they work without an Omniverse Kit runtime.

Root cause

spawn_preview_surface used CreateShaderPrimFromSdrCommand, and bind_visual_material used BindMaterialCommand. Both functions returned early when Kit was unavailable. As a result, non-Kit renderers imported otherwise valid USD geometry without its configured material and rendered the default neutral gray. MPM demos compensated with visualizer-specific conditionals.

Changes

  • define the material and UsdPreviewSurface shader directly with UsdShade
  • author typed shader inputs and connect the standard surface output
  • bind materials with UsdShade.MaterialBindingAPI
  • remove Kit checks and material-wrapper helpers from Snowball Smash, Granular, and Teapot Fill
  • use a portable translucent preview surface for Teapot Fill water instead of an MDL-only glass material

PreviewSurfaceCfg and bind_visual_material retain their existing public signatures and prim layout. MDL material spawning remains Kit-only.

Impact

This is a core fix, not an MPM-specific material implementation. Existing PreviewSurfaceCfg consumers automatically gain standard USD material authoring in Kitless runs. The repository currently uses the configuration from 89 Python files, including 18 demos, 8 tutorials, and 10 task files. No other visualizer-specific preview-surface workarounds were found; only the three MPM demos required call-site cleanup.

Examples that benefit without source changes include Newton ray-cast demos, visualization markers, UR10 Particle Push, lift and handover tasks, terrain materials, and asset-spawning tutorials. Existing Kit consumers keep the same configuration interface and /Shader prim layout.

Validation

  • kitless in-memory UsdPreviewSurface authoring and binding smoke passed
  • 25 Newton USD material-import tests passed
  • Snowball Smash, Granular, and Teapot Fill completed Newton GL smoke runs from this branch in isolation
  • Snowball Smash visually rendered all six crates with distinct authored colors
  • UR10 Particle Push completed a two-environment Newton smoke run with its existing PreviewSurfaceCfg declarations
  • git diff --check passed
  • uv.lock and pyproject.toml are unchanged

@maxkra15
maxkra15 marked this pull request as ready for review August 19, 2026 21:22
@maxkra15
maxkra15 requested a review from a team August 19, 2026 21:22
@greptile-apps

greptile-apps Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR replaces Kit-specific preview-surface authoring and visual-material binding with standard OpenUSD APIs, then removes renderer-specific material workarounds from three MPM demos.

  • Authors UsdPreviewSurface shaders and their typed inputs directly through UsdShade.
  • Binds visual materials through MaterialBindingAPI.
  • Uses portable preview materials in the granular, snowball, and teapot demos, including translucent teapot water.

Confidence Score: 4/5

The PR should not merge until Kitless binding continues to tolerate visual materials whose Kit-only spawners did not create a material prim.

A Kitless scene using an existing MDL visual-material configuration now reaches the changed missing-material check and aborts construction, whereas the previous binding path returned without failing.

Files Needing Attention: source/isaaclab/isaaclab/sim/utils/prims.py

Important Files Changed

Filename Overview
source/isaaclab/isaaclab/sim/spawners/materials/visual_materials.py Replaces command-based preview shader creation with portable UsdShade authoring while retaining Kit-only MDL spawning.
source/isaaclab/isaaclab/sim/utils/prims.py Replaces the Kit binding command with MaterialBindingAPI, but now raises when a Kit-only material was skipped in Kitless execution.
scripts/demos/mpm/teapot_fill.py Removes preview-material gating and replaces the fluid's MDL glass with a translucent preview surface.
scripts/demos/mpm/snowball_smash.py Configures crate preview materials for all supported renderer selections.
scripts/demos/mpm/newton_mpm_granular.py Configures collider preview materials without a Kit-specific wrapper.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Cfg[Visual material config] --> Spawn[Spawn material]
  Spawn -->|PreviewSurfaceCfg| USD[Author UsdShade material]
  Spawn -->|MDL without Kit| Missing[No material prim created]
  USD --> Bind[MaterialBindingAPI.Bind]
  Missing --> Bind
  Bind -->|Material exists| Geometry[Bound geometry]
  Bind -->|Material missing| Error[ValueError during scene construction]
Loading

Reviews (1): Last reviewed commit: "Make preview surfaces renderer agnostic" | Re-trigger Greptile

Comment on lines +823 to 824
if not material_prim.IsValid():
raise ValueError(f"Visual material '{material_path}' does not exist.")

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 Kitless MDL binding aborts scenes

When a Kitless scene assigns a Kit-only visual material such as GlassMdlCfg, its spawner returns without creating the material, but bind_visual_material now raises ValueError for the missing path, causing scene construction to fail instead of leaving the geometry unbound.

Knowledge Base Used: IsaacLab Core Simulation Layer

@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

The PR correctly replaces Kit-only preview-surface authoring and binding commands with standard OpenUSD APIs and removes renderer-specific workarounds from the MPM demos. However, removing the Kit guard from bind_visual_material introduces a Kit-less failure for MDL materials, whose spawning remains Kit-gated.

  • Design and architecture: Moving PreviewSurfaceCfg authoring into UsdShade and using MaterialBindingAPI is appropriately centralized and renderer-agnostic. The design remains incomplete for the existing MDL path: Kit-less MDL spawning is skipped, but material binding now proceeds and treats the intentionally absent material as an error.
  • API: The public signatures and preview-surface /Shader layout remain stable. Kit-less behavior of bind_visual_material changes materially for MdlFileCfg and GlassMdlCfg consumers, from returning False to raising ValueError because their material prim is not authored without Kit.
  • Implementation: The preview-surface shader ID, typed inputs, surface output connection, and updated demo call sites are consistent with the intended portable USD representation. The binding implementation needs to retain a graceful Kit-less path for MDL materials rather than validating their intentionally absent material prim and aborting asset spawning.

Minor fixes needed. Posted 1 actionable finding inline.

Automated review; human maintainers own approval decisions.

if not prim.IsValid():
raise ValueError(f"Target prim '{prim_path}' does not exist.")
material_prim = stage.GetPrimAtPath(material_path)
if not material_prim.IsValid():

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 — Kit-less MDL binding now raises instead of skipping

The removed if not has_kit(): return False guard also covered MDL materials. MDL spawning remains Kit-gated (has_kit is still imported and used in visual_materials.py), so in a Kit-less run an MdlFileCfg/GlassMdlCfg visual material authors no prim at material_path, and the subsequent bind call now raises ValueError and aborts asset spawning where it previously returned False. Preserve the graceful skip when the material prim is absent.

@github-actions github-actions Bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Aug 19, 2026
@maxkra15

Copy link
Copy Markdown
Contributor Author

@pbarejko can you please review this change? I am not an expert in this matter

@ooctipus

Copy link
Copy Markdown
Collaborator
Screenshot from 2026-08-19 17-03-24

There is a suprising change in golden

@maxkra15

Copy link
Copy Markdown
Contributor Author

this doesn't seem to be connected to this PR

@kellyguo11
kellyguo11 merged commit 3f87e32 into isaac-sim:develop Aug 20, 2026
46 of 48 checks passed
@ooctipus
ooctipus deleted the fix/preview-surface-renderer-agnostic branch August 20, 2026 20:47
kellyguo11 added a commit that referenced this pull request Aug 21, 2026
## Summary

Cherry-picks the following merged PRs from `develop` onto
`release/3.0.0`, preserving each as an individual commit with `-x`
provenance:

- #7193 — Bake CI pytest deps into the built Docker image
- #7077 — Add OVPhysX support to Franka deformable lift tasks
- #7175 — Raise on unsupported camera renderer outputs
- #7174 — Fix benchmark play inference scope
- #7173 — Report resolved backend for play benchmarks
- #7172 — Add video recording to play benchmarks
- #7215 — Reduce GearAssembly default environment count
- #7214 — Remove Kamino preset from open drawer
- #7213 — Fix OvPhysX scene gravity randomization
- #7212 — Fix OVPhysX material binding device selection
- #7189 — Make preview surfaces renderer agnostic
- #7206 — Fix OVPhysX benchmark articulation setup

All cherry-picks and the final rebase onto the latest `release/3.0.0`
tip completed without conflicts.

## Validation

- Verified all 12 backported commits have patch IDs identical to their
source squash commits and retain their `cherry picked from` footers.
- `git diff --check upstream/release/3.0.0..HEAD`
- Bash syntax validation for the modified CI shell scripts.
- YAML parsing for the modified composite actions.
- Changelog validation against `release/3.0.0`.
- Targeted pytest coverage for benchmark APIs/play, video recording,
GearAssembly defaults, OVPhysX presets and runtime semantics, and
renderer-agnostic materials: **81 passed, 4 skipped, 1 deselected**.
- The deselected case is an unchanged test that hard-codes a POSIX
`/tmp` path and fails on Windows path normalization.
- `uv run isaaclab -f` passed all hooks except the changelog hook's
known release-branch baseline finding for
`source/isaaclab/changelog.d/core-test-config-fixtures.skip`; the
targeted release-base changelog check passed.

---------

Co-authored-by: Matthew Taylor <[email protected]>
Co-authored-by: Antoine RICHARD <[email protected]>
Co-authored-by: Mike Yan Michelis <[email protected]>
Co-authored-by: Maximilian Krause <[email protected]>
Co-authored-by: Octi Zhang <[email protected]>
Co-authored-by: Mustafa H <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants