Repository navigation
Add native OpenCV lens-distortion rendering for the Newton renderer - #1
Draft
AntoineRichard wants to merge 1 commit into
Conversation
The camera OpenCV lens-distortion model (spawn.distortion) was consumed only by the RTX/OVRTX path; the Newton warp renderer logged a warning and rendered a centered, square-pixel pinhole. Implement the Newton path so a calibrated camera reproduces in Newton the same distortion RTX already applies. Newton's tiled camera renders by tracing an explicit per-pixel ray field, so the distortion is applied at ray-generation time: two Warp kernels invert the OpenCV forward model (pinhole rational radial + tangential + thin-prism, and fisheye equidistant) per output pixel to recover the undistorted ray direction, honoring the calibrated non-square, off-center fx/fy/cx/cy. apply_lens_distortion=False mutes the coefficients while keeping the intrinsics, matching the RTX/OVRTX behavior. No Newton-package change is required.
This was referenced Jul 20, 2026
Closed
Owner
|
@AntoineRichard Let's merge this since it works and passes on my end as well - later when the Newton camera utils will get finalised we port over, but this is now being request by Lab team to include newton support as part of the PR |
8 tasks done
StafaH
added a commit
to isaac-sim/IsaacLab
that referenced
this pull request
Sep 20, 2026
## Description PR #6608 introduced renderer-agnostic OpenCV camera calibration configs and native RTX/OVRTX rendering. The Newton path was intentionally left as a documented no-op that emitted a warning and rendered using a centered, square-pixel pinhole projection. This PR completes backend parity by making `NewtonWarpRenderer` consume the same OpenCV calibration and generate distorted per-pixel camera rays. ## This PR adds native OpenCV lens-distortion rendering to Newton: - **OpenCV pinhole:** Adds a Warp kernel that inverts the OpenCV forward model per pixel using fixed-point iteration. It supports rational radial (`k1..k6`), tangential (`p1`, `p2`), and thin-prism (`s1..s4`) distortion - conritbuted by @AntoineRichard in liorbenhorin#1 - **OpenCV fisheye:** Uses Newton’s native `compute_camera_rays_fisheye_opencv` helper rather than maintaining a duplicate Isaac Lab implementation. - **Calibrated intrinsics:** Both paths honor `fx/fy/cx/cy`, including non-square focal lengths and an off-center principal point. - **Disabled distortion:** `apply_lens_distortion=False` mutes the coefficients while retaining the calibrated intrinsics, matching RTX/OVRTX behavior. - **Renderer behavior:** Replaces the previous Newton warning/no-op path with distortion-aware ray generation. - **Tests:** Adds CPU unit tests for pinhole ray generation and CUDA integration tests for pinhole rendering, fisheye rendering, and intrinsic-matrix readback. This is a stacked follow-up to #6608. It does not change the public camera configuration or USD authoring path introduced there; it only adds Newton renderer consumption of the existing model. ## Release backport - [x] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `develop` ## Images <img width="1920" height="2146" alt="image222" src="https://github.com/user-attachments/assets/57764c1a-3be9-4c75-8609-62534834a465" /> ## 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 added a changelog fragment under `source/<pkg>/changelog.d/` for every touched package (do **not** edit `CHANGELOG.rst` or bump `extension.toml` — CI handles that) - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there --------- Co-authored-by: Kelly Guo <[email protected]> Co-authored-by: Mustafa H <[email protected]>
isaaclab-bot Bot
pushed a commit
to isaac-sim/IsaacLab
that referenced
this pull request
Sep 20, 2026
## Description PR #6608 introduced renderer-agnostic OpenCV camera calibration configs and native RTX/OVRTX rendering. The Newton path was intentionally left as a documented no-op that emitted a warning and rendered using a centered, square-pixel pinhole projection. This PR completes backend parity by making `NewtonWarpRenderer` consume the same OpenCV calibration and generate distorted per-pixel camera rays. ## This PR adds native OpenCV lens-distortion rendering to Newton: - **OpenCV pinhole:** Adds a Warp kernel that inverts the OpenCV forward model per pixel using fixed-point iteration. It supports rational radial (`k1..k6`), tangential (`p1`, `p2`), and thin-prism (`s1..s4`) distortion - conritbuted by @AntoineRichard in liorbenhorin#1 - **OpenCV fisheye:** Uses Newton’s native `compute_camera_rays_fisheye_opencv` helper rather than maintaining a duplicate Isaac Lab implementation. - **Calibrated intrinsics:** Both paths honor `fx/fy/cx/cy`, including non-square focal lengths and an off-center principal point. - **Disabled distortion:** `apply_lens_distortion=False` mutes the coefficients while retaining the calibrated intrinsics, matching RTX/OVRTX behavior. - **Renderer behavior:** Replaces the previous Newton warning/no-op path with distortion-aware ray generation. - **Tests:** Adds CPU unit tests for pinhole ray generation and CUDA integration tests for pinhole rendering, fisheye rendering, and intrinsic-matrix readback. This is a stacked follow-up to #6608. It does not change the public camera configuration or USD authoring path introduced there; it only adds Newton renderer consumption of the existing model. ## Release backport - [x] <!-- backport-active-release --> Backport this pull request to the active release branch after it merges into `develop` ## Images <img width="1920" height="2146" alt="image222" src="https://github.com/user-attachments/assets/57764c1a-3be9-4c75-8609-62534834a465" /> ## 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 added a changelog fragment under `source/<pkg>/changelog.d/` for every touched package (do **not** edit `CHANGELOG.rst` or bump `extension.toml` — CI handles that) - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there --------- Co-authored-by: Kelly Guo <[email protected]> Co-authored-by: Mustafa H <[email protected]> (cherry picked from commit a68caff)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Stacked on isaac-sim#6608. That PR added the renderer-agnostic OpenCV lens-distortion camera cfg (
OpenCvPinholeDistortionCfg/OpenCvFisheyeDistortionCfgonPinholeCameraCfg.distortion) and wired the RTX/OVRTX consumption path, leaving Newton as a documented no-op that warned and rendered undistorted. This PR implements the Newton consumption path so a calibrated camera reproduces in Newton the same distortion RTX already applies.Base branch:
liorbenhorin/opencv-lens-distortion-cameras(PR isaac-sim#6608) so the diff here shows only the Newton changes. Retarget todeveloponce isaac-sim#6608 merges.How
Newton's tiled camera renders by tracing an explicit per-pixel ray field, so distortion is applied at ray-generation time rather than by changing Newton itself:
opencv_distortion_rays.py: two@wp.kernelray generators that invert the OpenCV forward model per output pixel — pinhole (rational radialk1..k6+ tangentialp1,p2+ thin-prisms1..s4) and fisheye (equidistantk1..k4) — recovering the undistorted camera-space ray. The OpenCV→OpenGL axis conversion matches Newton's own pinhole ray kernel.newton_warp_renderer.py:RenderDatacapturesspawn.distortionand, when present, builds the distorted ray field via_build_distortion_rays(); the pinhole path is unchanged otherwise. The priorprepare_cameraswarning no-op is removed.apply_lens_distortion=Falsemutes the coefficients while keeping the calibratedfx/fy/cx/cy, matching the RTX/OVRTX behavior.No Newton-package change and no new dependencies.
Testing
Validated end-to-end on an RTX 5090 against the Newton commit pinned in this branch:
test/renderers/test_opencv_distortion_rays.py— 7 kit-less CPU Warp tests (round-trip inversion vs. a NumPy forward model, off-center principal point, zero-coefficient identity).test/sensors/test_camera_opencv_distortion_newton.py— 3 GPU Newton-render tests (distorted vs. muted and fisheye vs. pinholedistance_to_cameramaps differ meaningfully; intrinsics readback matches the authored non-square, off-center calibration). Skips cleanly withoutnewton/CUDA.All 10 pass; all content pre-commit hooks pass.
Type of change