Skip to content

Fix dropped DLSS frames in the Newton RTX visualizer - #8583

Closed
jnskkmhr wants to merge 2 commits into
isaac-sim:mainfrom
jnskkmhr:jnskkmhr/PR_DLSS_frame_drop
Closed

jnskkmhr wants to merge 2 commits into
isaac-sim:mainfrom
jnskkmhr:jnskkmhr/PR_DLSS_frame_drop

Conversation

@jnskkmhr

@jnskkmhr jnskkmhr commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

With DLSS frame generation enabled, Newton RTX can return multiple images per render request. The current acceptance path stops after the first image, dropping subsequent images and reducing the presentation rate.

For windowed, non-fullscreen LdrColor output, present each returned image and reuse prepared UI draw data for intermediate presentations. Retain the latest color image for capture; headless and fullscreen sensor-view paths skip intermediate presentations. Include an isaaclab_visualizers changelog fragment. No dependency changes are required.

Test plan

At bf786dd8e:

uv run --no-sync python -m pytest -q source/isaaclab_visualizers/test/test_newton_adapter.py

49/49 passed. The multi-image regression uses three distinct images, checks intermediate presentation order and reuse of prepared UI state, and verifies that capture owns the latest image. Reverting capture to the first image makes the regression fail. Full repository formatting/lint and changelog checks passed; tests emitted dependency deprecation warnings.

Fresh measurements used stock core velocity tasks on an RTX 5090, one environment, zero actions, 1920×1080, asynchronous rendering, VSync disabled, and DLSS frame generation enabled. Each run used 200 warm-up environment steps followed by a 20-second measurement.

Environment Baseline presentation FPS Fixed presentation FPS Environment steps/s (baseline → fixed)
Isaac-Velocity-Flat-G1 27.85 55.77 134.29 → 129.63
Isaac-Velocity-Rough-G1 27.85 55.47 123.89 → 111.20

Both runs used bf786dd8e and locked Newton 71eeba16a717d4dcf0b9dd7056a7b6f863054dc3. The baseline selected Newton's inherited _accept_render, the presentation path used at base ad3631474; the candidate selected this PR's override. This isolates the presentation change without changing physics or dependencies.

The baseline presented 557/1114 returned images in each task. The fix presented 1116/1116 (flat) and 1110/1110 (rough). FPS counts window presentations; it does not measure physics acceleration. The flat zero-action robot emitted stock MJWarp contact-capacity warnings; runtime/dependency warnings and rough-run asset-cleanup warnings were also observed.

Reproduce the presentation benchmark

Save the following as /tmp/benchmark-dlss-review.py:

import ctypes
import importlib.metadata
import json
import sys
import time

import warp as wp

wp.config.enable_backward = False
for entry in importlib.metadata.distribution("nvidia-cuda-nvrtc").files or ():
    if entry.name.startswith("libnvrtc-builtins.so."):
        ctypes.CDLL(str(importlib.metadata.distribution("nvidia-cuda-nvrtc").locate_file(entry)))
        break
from isaaclab_visualizers.newton.newton_visualizer import NewtonRTXVisualizer, NewtonViewerRTX
from newton.viewer import ViewerRTX

from isaaclab.envs import ManagerBasedRLEnv

from isaaclab_rl.entrypoints.simple_agents import run

mode, task = sys.argv[1:3]
counts = dict(present=0, images=0, steps=0)
start = None
accept = ViewerRTX._accept_render if mode == "before" else NewtonViewerRTX._accept_render
present = NewtonViewerRTX._present
initialize = NewtonRTXVisualizer.initialize
step = ManagerBasedRLEnv.step


def init(self, *args, **kwargs):
    self.cfg.window.size = (1920, 1080)
    return initialize(self, *args, **kwargs)


def accept_render(self, products):
    if start is not None:
        counts["images"] += sum(
            self._get_ldr_color_render_var(f) is not None for p in products.values() for f in p.frames
        )
    return accept(self, products)


def present_frame(self, *args, **kwargs):
    if start is not None:
        counts["present"] += 1
    return present(self, *args, **kwargs)


def advance(self, *args, **kwargs):
    global start
    result = step(self, *args, **kwargs)
    counts["steps"] += 1
    if counts["steps"] == 200:
        start = time.perf_counter()
    if start is not None and time.perf_counter() - start >= 20:
        elapsed = time.perf_counter() - start
        print(
            "RESULT",
            json.dumps(
                dict(
                    mode=mode,
                    task=task,
                    elapsed_s=elapsed,
                    **counts,
                    fps=counts["present"] / elapsed,
                    steps_per_second=(counts["steps"] - 200) / elapsed,
                )
            ),
            flush=True,
        )
        raise SystemExit(0)
    return result


NewtonRTXVisualizer.initialize = init
NewtonViewerRTX._accept_render = accept_render
NewtonViewerRTX._present = present_frame
ManagerBasedRLEnv.step = advance
run(["--task", task, "--num_envs", "1", "--viz", "newton_rtx", "--max_steps", "10000"], policy="zero")

From this branch, with the rsl-rl and ovrtx extras installed and a window display available:

uv run --no-sync python /tmp/benchmark-dlss-review.py before Isaac-Velocity-Flat-G1
uv run --no-sync python /tmp/benchmark-dlss-review.py after Isaac-Velocity-Flat-G1
uv run --no-sync python /tmp/benchmark-dlss-review.py before Isaac-Velocity-Rough-G1
uv run --no-sync python /tmp/benchmark-dlss-review.py after Isaac-Velocity-Rough-G1

Depends on / setup

Repo PR / branch Relationship
isaac-sim/IsaacLab develop Base branch; no prerequisite PRs
jnskkmhr/IsaacLab jnskkmhr/PR_DLSS_frame_drop This feature branch
isaac-sim/IsaacLab #8586 Independent camera-tracking feature; either PR can merge first

Type of change

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

Release backport

  • Backport this pull request to the active release branch after it merges into develop

Checklist

  • I have read and understood the contribution guidelines.
  • I have run the pre-commit checks with uv run isaaclab --format.
  • I have documented the changed behavior in the method docstring and package changelog.
  • My changes generate no new warnings (manual-run warnings remain to be isolated, as noted above).
  • I have validated the changed behavior and added a focused multi-image regression.
  • I have added a changelog fragment for every touched source package.
  • I have added my name to CONTRIBUTORS.md.

Merge notes

Targets develop. The underlying first-image-only acceptance behavior is in Newton; this adapter override may be removable once an equivalent upstream fix is adopted.

@github-actions github-actions Bot added the isaac-lab Related to Isaac Lab team label Oct 14, 2026
@jnskkmhr
jnskkmhr requested a balanced review from Copilot October 14, 2026 23:02

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@jnskkmhr
jnskkmhr marked this pull request as ready for review October 15, 2026 02:27
@jnskkmhr
jnskkmhr requested a review from a team October 15, 2026 02:27
@greptile-apps

greptile-apps Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] Fixes frame handling in the Newton RTX visualizer.

The PR appears safe to merge, with a non-blocking request for focused regression tests.

Findings

  1. P2 Multi-image behavior lacks regression tests ▶

Summary

Updates the Newton RTX adapter to present additional DLSS images and capture the latest returned image.

  • Newton RTX presents intermediate DLSS images and captures the newest one.
  • The contributor list now includes Junnosuke Kamohara.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Returned render products] --> B[Collect color images]
    B --> C{Intermediate image?}
    C -->|Yes| D{Window shown and no fullscreen image?}
    D -->|No| E[Skip intermediate image]
    D -->|Yes| F[Blit and present image]
    F --> G[Restore prepared UI state]
    C -->|No| H[Copy or blit latest image]
    H --> I[Native final presentation]
    A --> J[Capture searches frames in reverse order]
Loading

Reviews (1) · Last reviewed commit: "Fix dropped DLSS frames in the Newton RT..." · Reviewed by Greptile

Comment on lines +397 to +405
if intermediate:
frame = self._displayed_frame
prepared = self.gui is not None and self.gui._frame_prepared
self._present(frame.texture or None, frame.width, frame.height)
if self.gui is not None:
# Reuse the prepared UI without processing buttons again. The native
# prepare_frame counts the final presentation; count this extra one.
self.gui._frame_prepared = prepared
self.gui._update_fps()

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 Multi-image behavior lacks regression tests

The existing RTX tests check motion, pause, and markers, but do not count presentations or check which returned image is captured. They can pass even if this fix stops working.

Add focused tests for _accept_render and get_frame using distinct fake images. Check that every image reaches the window, capture returns the last image, and intermediate presentations reuse prepared UI data.

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!

@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

Needs attention: Style consistency (2). Other reviewed categories look good.

  • PR description: Qualify “Present each returned image” as windowed, non-fullscreen LdrColor output, add exact commands and base/head revisions to the performance evidence, and trim only the duplicated scope sentence from Merge notes.
  • Design and architecture: Architecture looks good.
  • Scope and over-engineering: No over-engineering issues.
  • API: API changes look good.
  • Compatibility and deprecation: No breaking changes identified.
  • Implementation: Implementation looks good.
  • Style consistency: The new _accept_render override leaves products untyped, and get_frame omits latest-frame selection; annotate the override and document the changed multi-image capture contract.
  • Test quality: Test quality looks good.

Minor fixes needed. Posted 2 inline findings.

Automated review; human maintainers own approval decisions.

@@ -362,6 +362,48 @@ def _init_window(self) -> None:
super()._init_window()
self._patch_viewer_panel()

def _accept_render(self, products) -> None:

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.

🟡 Warning · Style Consistency — Untyped products parameter

products carries no type hint while adjacent methods such as get_frame annotate every argument. Annotate the render-product mapping type, under a TYPE_CHECKING guard if the ovrtx import must stay runtime-only.

@@ -377,7 +419,7 @@ def get_frame(self, target_image: wp.array | None = None) -> wp.array:
if products is None:
raise RuntimeError("Perspective capture requires a completed Newton RTX frame.")
for product in products.values():
for frame in product.frames:
for frame in reversed(product.frames):

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.

🟡 Warning · Style Consistency — Stale get_frame docstring

Frame iteration now reverses so the latest image is captured, but the docstring still says only "the completed RTX image". State that the most recent frame is selected when a render returns multiple images.

@jnskkmhr
jnskkmhr force-pushed the jnskkmhr/PR_DLSS_frame_drop branch from bf786dd to 3b3b4c0 Compare October 15, 2026 19:16
@maxkra15 maxkra15 self-assigned this Oct 28, 2026
@maxkra15
maxkra15 self-requested a review October 28, 2026 12:43
@AntoineRichard

Copy link
Copy Markdown
Collaborator

Closing as superseded by #8585, which replaced the Newton ViewerRTX adapter with simulation-owned OVRTX camera rendering displayed in a Newton GL window. The NewtonViewerRTX._accept_render and capture paths changed by this PR are no longer used on current main, so this patch no longer applies to the active architecture.

This does not establish that DLSS multi-image handling is fixed in the replacement pipeline: OVRTXRenderer._process_render_products currently selects frames[0]. We are investigating whether generated images are still discarded there and what a follow-up against the current renderer should cover.

@AntoineRichard

Copy link
Copy Markdown
Collaborator

Follow-up investigation against the current OVRTX camera pipeline: #8881. The documented multi-frame API and current frames[0] selection warrant checking which image is published; native frame ordering and AOV contents still need validation on the pinned runtime. Generated-frame presentation cadence is a separate concern from selecting the correct sensor capture.

pbarejko pushed a commit that referenced this pull request Oct 30, 2026
…mes (#8882)

# Description

When DLSS frame generation returns an intermediate image before the real
camera capture, OVRTX readback currently publishes the first image and
discards the real one. Select the frame with the latest capture end time
before extracting any camera outputs or running PPISP. Keep the direct
single-frame path and the existing validation for missing
products/frames.

Extend the existing renderer contracts to verify real capture pixels,
other requested outputs, and matching asynchronous capture metadata,
including an output list whose newest frame is neither first nor last.
Add the `isaaclab_ov` changelog fragment. No dependency or public API
changes.

Fixes #8881. Follows #8583, whose original adapter was removed by #8585.

## Visual comparison

**Scene:** An orange cube moves sideways against a plain grey
background, viewed straight on from a fixed camera. The cube appears
nearly square because one face points toward the camera. The top row
shows the full frames; the bottom row enlarges the blue-box region. The
right column shows the pixel-difference heatmap.

Recorded native images from the same DLSS-enabled render request:
**before** is the intermediate image selected by `frames[0]`; **after**
is the latest real capture selected by this fix, 8.33 ms newer. The
lower row enlarges identical bounds. The heatmap shows the maximum
absolute RGB channel difference per pixel on a fixed 0–80 scale.

![Native frame 2: intermediate image before the fix, real capture after
the fix, and pixel-error heatmap with enlarged
crops.](https://raw.githubusercontent.com/AntoineRichard/IsaacLab/94c90a0928ab161e8cfc19a9a5aff26baa7b544c/dlss-frame-selection-step-2.png)

At frame 2, 129,036 RGB channel values differ before the fix (maximum
error 78/255). The fixed output has **zero pixel differences** from the
generation-disabled control. These are recorded pixels; the image panels
use nearest-neighbor display.

<details>
<summary>Second recorded capture: frame 15</summary>

![Native frame 15: before and after selection, with the same error scale
and enlarged
crop.](https://raw.githubusercontent.com/AntoineRichard/IsaacLab/94c90a0928ab161e8cfc19a9a5aff26baa7b544c/dlss-frame-selection-step-15.png)

At frame 15, the selected capture changes from 258.33 ms to 266.67 ms.
The baseline differs in 87,969 RGB channel values (maximum error
79/255); the fixed output again exactly matches the control.

</details>

## Validation

- Existing regression assertions failed before the fix: wrong
intermediate RGB values in delayed observations and actual CPU
extraction. They pass after the fix.
- Full renderer contract file: **53 passed**, including all five GPU
integration cases:

  ```bash
uv run python -m pytest -q
source/isaaclab_ov/test/test_ovrtx_renderer_contract.py
  ```

Validation used a separate uv environment with verified imports from
this worktree and pinned OVRTX `0.6.0.1791947691`, OVStage
`0.3.0.1791986420`, and Warp `1.17.0`. Torch deprecation warnings and
native runtime warnings were observed.
- Repository formatting/lint (`uv run isaaclab -f`), changelog
validation, and `git diff --check` passed. Independent review found no
blocking issues.
- Native reproduction used a moving cube at 1280×720, 60 Hz, on RTX 5090
/ driver `610.57.04`. With generation disabled, all 16 steps returned
one frame; enabled, all 16 returned two: an earlier intermediate
followed by the real capture.
- Replaying the unchanged baseline/fixed readback methods against those
native timestamps and saved pixels showed:

| Saved step | Baseline capture delay | Baseline differing RGBA channel
values | Fixed differing values |
  | --- | ---: | ---: | ---: |
  | 2 | 8.33 ms | 129,036 | 0 |
  | 15 | 8.33 ms | 87,969 | 0 |

At both saved steps, fixed output exactly matched the
generation-disabled control. Successful native activation used an
LDR-only render product together with explicit settings schemas,
`limitedOps=false`, inverse-compositing settings, and a RenderSettings
product relationship; the required companion setting was not isolated.
The synthetic missing-AOV case is test coverage, not a native
observation.

This change selects the correct single camera observation. Presenting
every generated image at a higher window cadence is separate work.

## Type of change

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

## Checklist

- [x] I have read and understood the contribution guidelines.
- [x] I have run the pre-commit checks with `uv run isaaclab --format`.
- [x] I have documented the changed behavior in the package changelog.
- [ ] My changes generate no new warnings (dependency/runtime warnings
observed as described above).
- [x] I have validated the changed behavior and applied the test-audit
criteria to the test changes.
- [x] I have added a changelog fragment for every touched source
package.
- [x] My name already exists in `CONTRIBUTORS.md`.
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