Skip to content

fix: support PreviewSurface binding in kitless mode#5205

Open
eric-heiden wants to merge 1 commit intoisaac-sim:developfrom
eric-heiden:fix/kitless-preview-material-binding
Open

fix: support PreviewSurface binding in kitless mode#5205
eric-heiden wants to merge 1 commit intoisaac-sim:developfrom
eric-heiden:fix/kitless-preview-material-binding

Conversation

@eric-heiden
Copy link
Copy Markdown

@eric-heiden eric-heiden commented Apr 8, 2026

Summary

  • author UsdPreviewSurface materials in kitless mode using pure USD APIs instead of skipping PreviewMaterial creation
  • fall back to UsdShade.MaterialBindingAPI for visual material binding when Kit commands are unavailable
  • stop skipping visual material overrides for USD-file spawners in kitless mode and add regression coverage for kitless + Kit-backed paths

Testing

  • pytest -q source/isaaclab/test/sim/test_kitless_visual_materials.py source/isaaclab/test/sim/test_spawn_shapes_kitless_preview_surface.py
  • python -m pytest -q source/isaaclab/test/sim/test_spawn_from_files.py -k visual_material
  • python -m compileall source/isaaclab/isaaclab/sim/spawners/from_files/from_files.py source/isaaclab/isaaclab/sim/spawners/materials/visual_materials.py source/isaaclab/isaaclab/sim/utils/prims.py source/isaaclab/test/sim/test_kitless_visual_materials.py source/isaaclab/test/sim/test_spawn_shapes_kitless_preview_surface.py source/isaaclab/test/sim/test_spawn_from_files.py

@github-actions github-actions bot added bug Something isn't working isaac-lab Related to Isaac Lab team labels Apr 8, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 8, 2026

Greptile encountered an error while reviewing this PR. Please reach out to support@greptile.com for assistance.

Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

Clean PR that properly extends kitless mode support for UsdPreviewSurface materials. The approach of using pure USD APIs as a fallback when Kit is unavailable is the right pattern.

What this does well:

  • The kitless shader creation in visual_materials.py correctly defines all standard UsdPreviewSurface inputs (diffuseColor, emissiveColor, roughness, metallic, opacity, opacityThreshold, ior) plus the required surface/displacement outputs, matching the USD spec.
  • The MaterialBindingAPI fallback in prims.py properly applies the API schema with Apply() when not already present, and correctly passes UsdShade.Tokens for binding strength rather than the string tokens used by the Kit command.
  • Removing the early-return guards in from_files.py and visual_materials.py now that the downstream functions handle kitless mode is the right cleanup.
  • Good test coverage across three new test files, including parametric binding-strength verification.

One minor nit (non-blocking):

In prims.py, the binding_strength string variable (lines 771–774) is now only consumed inside the has_kit() branch. Consider moving it inside that block to avoid computing a value that goes unused in kitless mode:

if has_kit():
    binding_strength = "strongerThanDescendants" if stronger_than_descendants else "weakerThanDescendants"
    import omni.kit.commands
    ...

Purely cosmetic — the code is correct as-is.

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.

1 participant