Skip to content

Draft: Reorganize RTX Code and Camera Refactoring #4772

Open
bareya wants to merge 8 commits intoisaac-sim:developfrom
bareya:pbarejko/rtx-fast-rendering
Open

Draft: Reorganize RTX Code and Camera Refactoring #4772
bareya wants to merge 8 commits intoisaac-sim:developfrom
bareya:pbarejko/rtx-fast-rendering

Conversation

@bareya
Copy link

@bareya bareya commented Feb 27, 2026

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
List any dependencies that are required for this change.

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (existing functionality will not work without user modification)
  • Documentation update

Screenshots

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

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 the isaac-lab Related to Isaac Lab team label Feb 27, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 27, 2026

Greptile Summary

This PR refactors the camera architecture to use a renderer-based approach, significantly improving code organization and separation of concerns.

Key Changes:

  • Moved RTX-specific initialization from Camera.__init__ to renderer utilities and _initialize_impl
  • Replaced lazy buffer allocation with eager allocation in _create_buffers
  • Extracted RTX setup functions (apply_rtx_sensors_setup, apply_simple_shading_mode, apply_rtx_disable_color_render) to isaac_rtx_renderer_utils.py
  • Simplified TiledCamera by removing ~200 lines of duplicate code, now inheriting renderer functionality from Camera
  • Consolidated all rendering logic into IsaacRtxRenderer.render() method

Breaking API Change:

  • camera.data.info type changed from list[dict[str, Any]] to dict[str, Any]. Users accessing camera.data.info[camera_index] will need to update to camera.data.info.get(data_type)

Tests & Examples:
All tests and tutorial scripts have been updated to reflect the new API and initialization timing (RTX sensors flag now set during _initialize_impl instead of __init__).

Confidence Score: 4/5

  • This PR is generally safe but contains a breaking API change that requires user code updates
  • The refactoring is well-structured and improves code organization. However, the breaking change to camera.data.info structure requires careful migration. All internal tests and examples have been updated, but external users will need to update their code. The core rendering logic is preserved and properly tested.
  • Pay attention to camera_data.py (breaking API change) and verify migration guide for users

Important Files Changed

Filename Overview
source/isaaclab/isaaclab/sensors/camera/camera.py Major refactoring to use renderer-based architecture, moving RTX-specific code out of Camera class. Eager buffer allocation replaces lazy allocation.
source/isaaclab_physx/isaaclab_physx/renderers/isaac_rtx_renderer.py Refactored to use extracted RTX utility functions. All rendering logic consolidated into render() method.
source/isaaclab_physx/isaaclab_physx/renderers/isaac_rtx_renderer_utils.py New utility functions extract RTX setup logic from Camera class, improving separation of concerns.
source/isaaclab/isaaclab/sensors/camera/tiled_camera.py Significantly simplified by inheriting renderer-based approach from Camera. Removed ~200 lines of duplicate code.
source/isaaclab/isaaclab/sensors/camera/camera_data.py Breaking change: info type changed from list[dict[str, Any]] to dict[str, Any].

Class Diagram

%%{init: {'theme': 'neutral'}}%%
classDiagram
    class SensorBase {
        <<abstract>>
    }
    
    class Camera {
        -renderer: Renderer
        -render_data: RenderData
        -_data: CameraData
        +__init__(cfg)
        +_initialize_impl()
        +_update_buffers_impl()
        +_create_buffers()
    }
    
    class TiledCamera {
        +reset()
        +_check_supported_data_types()
    }
    
    class CameraData {
        +info: dict[str, Any]
        +output: dict[str, Tensor]
        +pos_w: Tensor
        +quat_w_world: Tensor
    }
    
    class BaseRenderer {
        <<abstract>>
        +create_render_data()*
        +render()*
        +cleanup()*
    }
    
    class IsaacRtxRenderer {
        +create_render_data()
        +render()
        +write_output()
        +cleanup()
    }
    
    class RTXUtils {
        <<utility>>
        +apply_rtx_sensors_setup()
        +apply_simple_shading_mode()
        +apply_rtx_disable_color_render()
    }
    
    SensorBase <|-- Camera
    Camera <|-- TiledCamera
    Camera --> CameraData : contains
    Camera --> BaseRenderer : uses
    BaseRenderer <|-- IsaacRtxRenderer
    Camera ..> RTXUtils : calls
    IsaacRtxRenderer ..> RTXUtils : calls
Loading

Last reviewed commit: 438618b

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

10 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

data_dict["albedo"] = torch.zeros(
(self._view.count, self.cfg.height, self.cfg.width, 4), device=self.device, dtype=torch.uint8
).contiguous()
for data_type in SIMPLE_SHADING_MODES:
Copy link
Author

Choose a reason for hiding this comment

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

This is wrong this code doesn't belong here because it's an implementation detail of Isaac RTX Renderer

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.

1 participant