Skip to content

Expose Newton visualizer particle options - #6042

Merged
kellyguo11 merged 1 commit into
isaac-sim:developfrom
maxkra15:max/newton-visualizer-particles
Jun 9, 2026
Merged

kellyguo11 merged 1 commit into
isaac-sim:developfrom
maxkra15:max/newton-visualizer-particles

Conversation

@maxkra15

@maxkra15 maxkra15 commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Description

This PR adds particle visualization controls to NewtonVisualizerCfg.

It exposes:

  • show_particles to enable Newton particle rendering through config.
  • particle_color to optionally override the Newton viewer particle color for /model/particles.

Motivation: MPM and particle-based demos currently need to reach into the private Newton viewer instance to show particles
or customize particle appearance. This keeps that behavior on the public visualizer config surface and preserves Newton’s
default behavior when particle_color=None.

Fixes # N/A

Type of change

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

Screenshots

Not applicable.

Checklist

  • I have added tests that prove my feature works
  • I have run the pre-commit checks with ./isaaclab.sh --format

@maxkra15
maxkra15 requested a review from ooctipus June 8, 2026 23:28
@github-actions github-actions Bot added the isaac-lab Related to Isaac Lab team label Jun 8, 2026

@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 — PR #6042

Expose Newton visualizer particle options by @maxkra15


✅ Summary

Clean, focused PR that adds two new config options (show_particles and particle_color) to NewtonVisualizerCfg and threads them through to the Newton viewer. The implementation correctly caches the Warp color buffer to avoid per-frame allocations and preserves Newton defaults when particle_color=None.


📋 Findings

# Severity File Finding
1 💡 suggestion newton_visualizer.py The log_points override only intercepts /model/particles. Consider whether this should be documented in a docstring to clarify it will not apply to other particle-like point clouds (e.g. /model/debris or user-defined paths).
2 💡 suggestion newton_visualizer_cfg.py The particle_color field allows any tuple[float, float, float] without clamping to [0, 1]. Consider adding a __post_init__ validator or a note in the docstring that values outside [0, 1] are passed through to Newton as-is.
3 ℹ️ note newton_visualizer.py In initialize(), self._viewer.particle_color = self.cfg.particle_color assigns the cfg tuple directly to the viewer instance. This is then also picked up by the log_points override via self.particle_color. Confirm there is no conflict — the __init__ also sets self.particle_color = None, so initialize() must run before particles render (which it does). Looks correct.
4 ⚠️ minor newton_visualizer.py _particle_color_array uses self.device which is set in NewtonViewerGL.__init__. If particle_color is set before __init__ completes (e.g., via a subclass), this could error. Current usage path is safe but worth a note.
5 ✅ positive test_newton_adapter.py Good test coverage: config instantiation, color override on /model/particles, and pass-through for other point names.

🏁 CI Status

  • ❌ Check changelog fragments — Missing changelog fragment. Please add a fragment for the new feature.
  • ✅ pre-commit passed
  • ✅ Build Wheel passed
  • ⏳ Several checks still pending (Docker builds, installation tests)

🎯 Verdict

Looks good overall. Minor suggestions above. The main actionable item is the missing changelog fragment (CI failure). Once that is addressed this should be ready.

Findings: 5 (0 blocking, 1 minor, 2 suggestions, 1 note, 1 positive)


🔄 Update (0b464f3e)

Force-push with changelog fragment added (changelog.d/max-newton-visualizer-particles.rst). This addresses the CI failure noted above — the Check changelog fragments check should now pass. ✅

No other functional code changes detected in this update. The implementation, tests, and config remain the same as previously reviewed.

Status: Ready to merge (pending CI green). Previous suggestions remain non-blocking recommendations.


🔄 Update (8e4c70d5)

Commits squashed into a single clean commit. No functional changes — implementation, tests, config, and changelog fragment are all identical to the previously reviewed version.

Status: Ready to merge ✅ — all previous feedback remains non-blocking.

@greptile-apps

greptile-apps Bot commented Jun 8, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR exposes two new particle visualization controls — show_particles and particle_color — on NewtonVisualizerCfg, mirroring the pattern already used for joints, contacts, springs, and other show_* flags. A log_points override in NewtonViewerGL intercepts the /model/particles path and replaces the colors argument with a cached Warp vec3 array when particle_color is set, preserving Newton's default behavior when it is None.

  • NewtonVisualizerCfg gains show_particles: bool = False and particle_color: tuple[float, float, float] | None = None; both are forwarded to the viewer and logged in the initialization table.
  • NewtonViewerGL adds a log_points override with a count- and value-keyed buffer cache (_particle_color_array) to avoid re-allocating a Warp array on every frame when the color is unchanged.
  • Three new unit tests cover config field exposure, color override injection, and passthrough of non-particle point paths.

Confidence Score: 4/5

Safe to merge. The changes are additive, well-contained, and follow the established patterns for other show_* config flags.

The implementation is clean and the new log_points override correctly guards both the name and None checks before touching the colors argument. The only noticeable inconsistency is that show_particles is not wired up to a live UI checkbox in render_left_panel, whereas every other show* property has one — meaning the flag is locked to its initial config value at runtime.

newton_visualizer.py — specifically the render_left_panel Visualization section, which should receive a show_particles checkbox to match the existing show* UI pattern.

Important Files Changed

Filename Overview
source/isaaclab_visualizers/isaaclab_visualizers/newton/newton_visualizer.py Adds particle_color instance vars and caching logic to NewtonViewerGL, a log_points override that intercepts /model/particles, and wires show_particles/particle_color from the config into the viewer at initialization. The only gap is that show_particles lacks a live UI checkbox unlike its sibling show_* flags.
source/isaaclab_visualizers/isaaclab_visualizers/newton/newton_visualizer_cfg.py Adds show_particles bool (default False) and optional particle_color tuple to NewtonVisualizerCfg, consistent with existing show_* and color field patterns.
source/isaaclab_visualizers/test/test_newton_adapter.py Adds three focused tests: cfg field exposure, particle color override via log_points, and non-particle path passthrough. Tests are well-structured but missing a test for the color/count cache-hit path.

Sequence Diagram

sequenceDiagram
    participant NV as NewtonVisualizer
    participant GL as NewtonViewerGL
    participant VGL as ViewerGL (Newton)

    NV->>GL: initialize() — set show_particles, particle_color
    Note over GL: stores particle_color on self

    loop Each frame
        NV->>GL: step() → viewer.log_state(state)
        VGL-->>GL: log_points("/model/particles", points, ...)
        GL->>GL: "log_points override: check name == /model/particles"
        alt particle_color is set
            GL->>GL: _particle_color_array(len(points)) → cached wp.array
            GL->>VGL: "super().log_points(..., colors=wp.array)"
        else particle_color is None
            GL->>VGL: "super().log_points(..., colors=original)"
        end
    end
Loading

Comments Outside Diff (1)

  1. source/isaaclab_visualizers/isaaclab_visualizers/newton/newton_visualizer.py, line 239-258 (link)

    P2 show_particles has no UI checkbox while all peer properties do

    Every other show_* property (show_joints, show_contacts, show_collision, show_springs, show_inertia_boxes, show_com) has a corresponding imgui.checkbox in _render_left_panel, letting users toggle it live from the viewer. show_particles is missing that entry. As a result, the flag is frozen at whatever value was set in the config at initialization; there is no way to turn particle rendering on or off from the running viewer UI — unlike every other visualization toggle in the same panel.

Reviews (1): Last reviewed commit: "Expose Newton visualizer particle option..." | Re-trigger Greptile

@maxkra15
maxkra15 force-pushed the max/newton-visualizer-particles branch from b53b1b1 to 0b464f3 Compare June 8, 2026 23:34
@maxkra15
maxkra15 force-pushed the max/newton-visualizer-particles branch from 0b464f3 to 8e4c70d Compare June 8, 2026 23:59
Comment on lines +173 to +179
def log_points(self, name, points, radii=None, colors=None, hidden=False):
"""Apply configured model-particle appearance while preserving Newton's point logging.

The configured particle color only applies to Newton's canonical
``/model/particles`` point batch. User-defined point clouds retain the
colors provided by their own ``log_points`` calls.
"""

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is a public function please document the I/Os

@kellyguo11
kellyguo11 merged commit d720975 into isaac-sim:develop Jun 9, 2026
37 checks passed
@maxkra15
maxkra15 deleted the max/newton-visualizer-particles branch June 9, 2026 16:21
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.

4 participants