Skip to content

Fix Newton particle BVH synchronization - #6687

Merged
huidongc merged 3 commits into
isaac-sim:developfrom
huidongc:particle-rendering-with-newton-warp
Jul 24, 2026
Merged

huidongc merged 3 commits into
isaac-sim:developfrom
huidongc:particle-rendering-with-newton-warp

Conversation

@huidongc

Copy link
Copy Markdown
Collaborator

Description

Build and refit particle BVHs through the sensor task pipeline so moving particles remain visible to Newton Warp cameras. Raise a runtime error when BVH refitting lacks an initialized sensor state.

Type of change

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

Screenshots

Please attach before and after screenshots of the change if applicable.

Before After
franka_pour-newton-newton_renderer-rgb franka_pour-newton-newton_renderer-rgb

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

@huidongc
huidongc requested a review from a team July 23, 2026 08:37
@github-actions github-actions Bot added the isaac-lab Related to Isaac Lab team label Jul 23, 2026
@greptile-apps

greptile-apps Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes Newton Warp camera rendering of moving particles by keeping the particle BVH synchronized with the simulation state through the existing sensor task pipeline. It mirrors the shape BVH handling already in place, adding particle BVH build during sensor registration and particle BVH refit during each update cycle.

  • _register_sensor_task now calls bvh_build_particles when particle_count > 0 and no particle BVH exists, matching the existing shape BVH build path.
  • _refit_sensor_bvh is extended to refit both shape and particle BVHs, and the previous bare assert on _sensor_state is replaced with a descriptive RuntimeError.
  • Two new unit tests cover the missing-state error case and the full build-then-refit ordering.

Confidence Score: 5/5

Safe to merge — the change is a narrow, well-tested extension of an existing pattern with no behavioral regressions for shape-only scenes.

The particle BVH path is a direct parallel of the shape BVH path that was already in place and working. Both _register_sensor_task and _refit_sensor_bvh are updated symmetrically, the bare assert is promoted to a RuntimeError with a clear message, and two focused unit tests verify the new code paths without relying on real Newton state.

No files require special attention.

Important Files Changed

Filename Overview
source/isaaclab_newton/isaaclab_newton/physics/newton_manager.py Adds particle BVH build in _register_sensor_task and extends _refit_sensor_bvh to refit both shape and particle BVHs; replaces the bare assert on _sensor_state with a proper RuntimeError.
source/isaaclab_newton/test/physics/test_newton_manager_abstraction.py Two new unit tests cover the particle BVH path: one verifies the RuntimeError on missing sensor state, the other verifies full build-and-refit ordering before a render task executes.
source/isaaclab_newton/changelog.d/huidongc-newton-warp-particle-bvh.rst New changelog fragment describing the particle BVH synchronization fix.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[_register_sensor_task] --> B{model.shape_count > 0\nand bvh_shapes is None?}
    B -- Yes --> C[bvh_build_shapes]
    B -- No --> D{model.particle_count > 0\nand bvh_particles is None?}
    C --> D
    D -- Yes --> E[bvh_build_particles]
    D -- No --> F[Register task / set state dirty]
    E --> F

    G[_update_sensor_tasks] --> H{sensor_state_dirty?}
    H -- Yes --> I[_refit_sensor_bvh]
    H -- No --> L[Run sensor tasks]
    I --> J{refit_shapes?}
    J -- Yes --> K1[bvh_refit_shapes]
    J -- No --> K2{refit_particles?}
    K1 --> K2
    K2 -- Yes --> K3[bvh_refit_particles]
    K2 -- No --> L
    K3 --> L[Run sensor tasks]
Loading

Reviews (2): Last reviewed commit: "Monkeypatch NewtonManager._sensor_state ..." | Re-trigger Greptile

@huidongc
huidongc requested a review from StafaH July 23, 2026 08:56
@huidongc

Copy link
Copy Markdown
Collaborator Author

@greptile-apps

@maxkra15 maxkra15 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.

thanks! lgtm, just some minor suggestions for test and comments

@kellyguo11 kellyguo11 mentioned this pull request Jul 23, 2026
7 tasks done
kellyguo11 added a commit that referenced this pull request Jul 23, 2026
# Description

Restore the CPU PhysX stage-initialization path from #4675 while
preserving the
Isaac Sim core-extension removal from #6499.

#6499 removed `isaacsim.core.simulation_manager`, which also removed the
registration bridge between the unified physics API and PhysX. The
replacement
CPU path explicitly attached the stage and skipped
`force_load_physics_from_usd()`. This reintroduced non-deterministic CPU
broadphase collision failures, observed by the SkillGen test in #6687.

This change:

- adds `omni.physics.physx` to the GUI and headless app experiences so
PhysX is
  registered without restoring the Isaac Sim core extension or its Warp
  dependency;
- restores the pre-#6499 warmup behavior: only GPU explicitly attaches
the
  stage, while CPU uses `force_load_physics_from_usd()`;
- updates the regression test to verify the bridge is enabled, CPU does
not call
  `attach_stage()`, and CPU force-loads exactly once.

## Type of change

- Bug fix (non-breaking change which fixes an issue)

## Screenshots

Not applicable.

## Validation

- `uv run python -m pytest
source/isaaclab_physx/test/assets/test_rigid_object.py::test_warmup_attach_stage_not_called_for_cpu
source/isaaclab_physx/test/assets/test_rigid_object.py::test_initialization
-q`
  - 5 passed across CPU and GPU initialization.
- CPU SkillGen environment creation and 20 random-action steps passed
for
  `IsaacContrib-Stack-Cube-Franka-IK-Rel-Skillgen`.
- `uv run python tools/changelog/cli.py check develop`
- `uv run isaaclab -f`

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`uv run isaaclab -f`
- [x] Documentation changes are not required for this internal lifecycle
fix
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective
- [x] I have added a changelog fragment under
`source/isaaclab_physx/changelog.d/`
- [x] My name already exists in `CONTRIBUTORS.md`
huidongc added 3 commits July 24, 2026 10:22
Build and refit particle BVHs through the sensor task pipeline so moving
particles remain visible to Newton Warp cameras. Raise a runtime error when
BVH refitting lacks an initialized sensor state.
sensor-task test does not leak class attributes after teardown.
Patch sensor graph flag arrays so pytest teardown restores consistent NewtonManager state. Clarify that sensor tasks refit both shape and particle BVHs.
@huidongc
huidongc force-pushed the particle-rendering-with-newton-warp branch from c55661f to 80313fb Compare July 24, 2026 02:23
@huidongc
huidongc merged commit aa0690a into isaac-sim:develop Jul 24, 2026
41 checks passed
@huidongc
huidongc deleted the particle-rendering-with-newton-warp branch July 24, 2026 05:02
matthewtrepte pushed a commit to matthewtrepte/IsaacLab that referenced this pull request Aug 4, 2026
# Description

Restore the CPU PhysX stage-initialization path from isaac-sim#4675 while
preserving the
Isaac Sim core-extension removal from isaac-sim#6499.

isaac-sim#6499 removed `isaacsim.core.simulation_manager`, which also removed the
registration bridge between the unified physics API and PhysX. The
replacement
CPU path explicitly attached the stage and skipped
`force_load_physics_from_usd()`. This reintroduced non-deterministic CPU
broadphase collision failures, observed by the SkillGen test in isaac-sim#6687.

This change:

- adds `omni.physics.physx` to the GUI and headless app experiences so
PhysX is
  registered without restoring the Isaac Sim core extension or its Warp
  dependency;
- restores the pre-isaac-sim#6499 warmup behavior: only GPU explicitly attaches
the
  stage, while CPU uses `force_load_physics_from_usd()`;
- updates the regression test to verify the bridge is enabled, CPU does
not call
  `attach_stage()`, and CPU force-loads exactly once.

## Type of change

- Bug fix (non-breaking change which fixes an issue)

## Screenshots

Not applicable.

## Validation

- `uv run python -m pytest
source/isaaclab_physx/test/assets/test_rigid_object.py::test_warmup_attach_stage_not_called_for_cpu
source/isaaclab_physx/test/assets/test_rigid_object.py::test_initialization
-q`
  - 5 passed across CPU and GPU initialization.
- CPU SkillGen environment creation and 20 random-action steps passed
for
  `IsaacContrib-Stack-Cube-Franka-IK-Rel-Skillgen`.
- `uv run python tools/changelog/cli.py check develop`
- `uv run isaaclab -f`

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`uv run isaaclab -f`
- [x] Documentation changes are not required for this internal lifecycle
fix
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective
- [x] I have added a changelog fragment under
`source/isaaclab_physx/changelog.d/`
- [x] My name already exists in `CONTRIBUTORS.md`
matthewtrepte pushed a commit to matthewtrepte/IsaacLab that referenced this pull request Aug 4, 2026
# Description

Build and refit particle BVHs through the sensor task pipeline so moving
particles remain visible to Newton Warp cameras. Raise a runtime error
when BVH refitting lacks an initialized sensor state.

## Type of change

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

## Screenshots

Please attach before and after screenshots of the change if applicable.

| Before | After |
| ------ | ----- |
| <img width="262" height="262"
alt="franka_pour-newton-newton_renderer-rgb"
src="https://github.com/user-attachments/assets/d034705d-54da-48ba-903c-2979b9537c49"
/> | <img width="262" height="262"
alt="franka_pour-newton-newton_renderer-rgb"
src="https://github.com/user-attachments/assets/b05d71b3-0a31-4b53-afc2-fbe4d381c842"
/> |

## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
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