Skip to content

Add segmentation annotator support to Newton Warp renderer integration#6506

Open
rilei-nvidia wants to merge 5 commits into
isaac-sim:developfrom
rilei-nvidia:newton-warp-segmentation-annotators
Open

Add segmentation annotator support to Newton Warp renderer integration#6506
rilei-nvidia wants to merge 5 commits into
isaac-sim:developfrom
rilei-nvidia:newton-warp-segmentation-annotators

Conversation

@rilei-nvidia

@rilei-nvidia rilei-nvidia commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Description

Bring the segmentation annotators (semantic_segmentation, instance_segmentation_fast) in the Newton Warp renderer integration to full parity with what the Isaac RTX renderer provides. This includes producing the idToLabels and/or idToSemantics dicts for mapping segmented IDs/colors to their respective prim path or semantic label.

The main difference between supporting segmentation annotators for Newton warp vs ovrtx is that the Newton model only tracks the prim paths for each shape but not their semantic labels. So via the NewtonModel.shape_label array and its USD stage, we build the mappings from shape_index -> semantics upfront. Then there are warp kernels that process the shape index image into either an ID map or colorized map (see new golden images). All this logic is encapsulated in the new isaaclab_newton/renderers/segmentation.py module.

Light refactoring was done to share common variables / logic for around segmentation and colorization between the ovrtx and newton renderer integrations.

Type of change

  • New feature (non-breaking change which adds functionality)
  • Documentation update

Screenshots

See golden images

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@github-actions github-actions Bot added documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team labels Jul 14, 2026
@rilei-nvidia
rilei-nvidia force-pushed the newton-warp-segmentation-annotators branch 13 times, most recently from 1466cb7 to 2a774dc Compare July 16, 2026 06:21
@rilei-nvidia
rilei-nvidia marked this pull request as ready for review July 16, 2026 06:28
@rilei-nvidia rilei-nvidia changed the title Draft: Add segmentation outputs to Newton Warp renderer Add segmentation annotator support to Newton Warp renderer integration Jul 16, 2026
@greptile-apps

greptile-apps Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This draft PR brings semantic_segmentation and instance_segmentation_fast to full parity with the Isaac RTX renderer for the Newton Warp backend, and consolidates the shared color-palette logic into a new segmentation_colors.py module consumed by both the OVRTX and Newton paths.

  • New segmentation.py: walks the USD stage per model.shape_label prim path, assigns semantic/instance SegIds, builds device-side shape_to_id / shape_to_color lookup tables, and remaps Newton's raw shape_index_image into each requested annotator output via dedicated Warp kernels.
  • segmentation_colors.py extraction: removes the duplicated color_hash / random_color_from_id Warp functions from ovrtx_renderer_kernels.py and re-exports the canonical host + device pair; a new test_segmentation_colors.py asserts byte-level parity between the two implementations.
  • Newton renderer wiring: replaces the direct instance_segmentation_image buffer with a shared shape_index_scratch, adds a convert_segmentation() post-render step, and publishes idToLabels / idToSemantics metadata into camera_data.info.

Confidence Score: 2/5

Not ready to merge — a leftover debug exception in the new segmentation module will crash every camera that requests a segmentation output, and all new unit tests will fail before running a single assertion.

The build_mapping method in segmentation.py unconditionally raises Exception("Howdy") after populating the mapping cache. Since create_render_data calls build_mapping for every segmentation data type, no camera configured with semantic_segmentation or instance_segmentation_fast can complete initialization. The five tests in test_segmentation.py all call build_mapping directly and will fail for the same reason. Beyond that one blocker, the architecture is sound: the color-palette extraction, kernel logic, USD ancestry walk, and filter predicate re-implementation are all well-structured.

segmentation.py — the build_mapping method needs the debug raise removed before the feature is usable. newton_warp_renderer.py — confirm self._newton_model is already an attribute of the class; it is referenced in create_render_data but not introduced in this diff.

Important Files Changed

Filename Overview
source/isaaclab_newton/isaaclab_newton/renderers/segmentation.py New module implementing shape-index-to-segmentation-id mapping for Newton renderer; contains a critical debug artifact (raise Exception("Howdy")) in build_mapping that makes all segmentation outputs fail at runtime.
source/isaaclab_newton/isaaclab_newton/renderers/newton_warp_renderer.py Adds semantic_segmentation support alongside instance_segmentation_fast; replaces the direct instance_segmentation_image buffer with a shared shape_index_scratch routed through NewtonSegmentationMapper; references self._newton_model whose declaration is not visible in this diff.
source/isaaclab_newton/isaaclab_newton/renderers/newton_warp_renderer_cfg.py Adds semantic_filter, colorize_semantic_segmentation, and semantic_segmentation_mapping config fields; mutable dict = {} default for semantic_segmentation_mapping may share state across instances if not handled by the config framework.
source/isaaclab/isaaclab/renderers/segmentation_colors.py New shared module extracting the golden-ratio HSV color palette and MurmurHash3 finalizer into one place; provides paired host and Warp device implementations tested for byte-level parity.
source/isaaclab_ov/isaaclab_ov/renderers/ovrtx_renderer_kernels.py Removes the now-deduplicated color_hash / random_color_from_id Warp functions and imports the canonical random_color_from_id_wp from segmentation_colors; straightforward refactor with no logic changes.
source/isaaclab_newton/test/renderers/test_segmentation.py New unit tests for NewtonSegmentationMapper; all five test cases will raise Exception("Howdy") at the build_mapping call due to the debug artifact in the production code.
source/isaaclab_ov/isaaclab_ov/renderers/ovrtx_annotator_utils.py Replaces local reserved-id constants with the canonical BACKGROUND_ID/UNLABELLED_ID from segmentation_colors and inlines unpack_rgba; clean deduplication with no behavior change.
source/isaaclab/test/renderers/test_segmentation_colors.py New host-vs-device parity tests for segmentation_colors; migrates the color-kernel tests from test_ovrtx_renderer_kernels.py and adds a CPU parity check; well-structured.

Reviews (1): Last reviewed commit: "Add segmentation outputs to Newton Warp ..." | Re-trigger Greptile

Comment thread source/isaaclab_newton/isaaclab_newton/renderers/segmentation.py
(id/color to prim path) and ``idToSemantics`` (id/color to semantic label).
"""

semantic_segmentation_mapping: dict = {}

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 Mutable default in config field

Using a bare dict literal {} as a class-level default is a Python antipattern; if NewtonWarpRendererCfg is not wrapped by a @configclass decorator that rewrites mutable defaults, all instances will share the same dict object. Consider using field(default_factory=dict) (for dataclass) or the framework's equivalent to make this safe regardless of the decorator.

Suggested change
semantic_segmentation_mapping: dict = {}
semantic_segmentation_mapping: dict = field(default_factory=dict)

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!

@rilei-nvidia
rilei-nvidia force-pushed the newton-warp-segmentation-annotators branch from 2a774dc to 1b58988 Compare July 16, 2026 06:34
@rilei-nvidia
rilei-nvidia force-pushed the newton-warp-segmentation-annotators branch 2 times, most recently from dafbefa to 32f669f Compare July 17, 2026 02:43
Comment thread source/isaaclab_newton/isaaclab_newton/renderers/newton_warp_renderer.py Outdated
Comment thread source/isaaclab_newton/isaaclab_newton/renderers/newton_warp_renderer.py Outdated
Comment thread source/isaaclab_newton/isaaclab_newton/renderers/newton_warp_renderer.py Outdated
Comment thread source/isaaclab_newton/isaaclab_newton/renderers/newton_warp_renderer.py Outdated
@rilei-nvidia
rilei-nvidia force-pushed the newton-warp-segmentation-annotators branch from 32f669f to 04f121e Compare July 20, 2026 23:50
@rilei-nvidia
rilei-nvidia requested a review from pbarejko as a code owner July 20, 2026 23:50
Add semantic_segmentation to the Newton Warp renderer and bring the
existing instance_segmentation_fast up to full parity with the Isaac
RTX renderer, including colorized RGBA output and idToLabels /
idToSemantics metadata on camera.data.info.

Newton emits only a per-shape index, so the three outputs are
reconstructed on the host: shape indices are mapped to semantic /
instance / instance-id spaces from model.shape_label prim paths and the
USD stage's UsdSemantics.LabelsAPI labels, honoring semantic_filter and
semantic_segmentation_mapping, then remapped into each output by a Warp
kernel. Add the matching colorize_* / semantic_filter /
semantic_segmentation_mapping fields to NewtonWarpRendererCfg.

Extract the RTX/Replicator colorization (random_color_from_id /
color_hash) into a shared isaaclab.renderers.segmentation_colors module
so the Newton and OVRTX backends produce identical colors from a single
source of truth; refactor the OVRTX kernels to use it.

Update the camera docs support matrix, the Newton-supported data-type
whitelists in the dexsuite and shadow_hand env configs, and the
rendering correctness tests, and add golden images for the new outputs.
@rilei-nvidia
rilei-nvidia force-pushed the newton-warp-segmentation-annotators branch from 3a75d80 to d7efc43 Compare July 21, 2026 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants