Source code for gs_nyx_plugin.nyx_camera_options

"""
Nyx Camera Options for Genesis - GPU-accelerated rendering via Nyx renderer.
"""

# External imports
from pydantic import ConfigDict, Field
from typing import TYPE_CHECKING, Literal, Annotated

# Internal imports
import genesis as gs
from genesis.options.sensors.camera import BaseCameraOptions
from genesis.typing import PositiveInt, PositiveFloat, PositiveVec2IType
from gs_nyx import nyx_py_sdk as nps
from gs_nyx import nyx_py_renderer as npr

if TYPE_CHECKING:
    pass


__all__ = ["NyxCameraOptions"]


# Register init and destroy functions for the Nyx sdk plugin.
gs.register_external_module(nps.startup, nps.shutdown)


# ========================== Nyx Camera Options ==========================
[docs] class NyxCameraOptions(BaseCameraOptions["NyxCameraSensor"]): """ Options for the Nyx Camera Sensor plugin. Inherits from BaseCameraOptions which provides: - res, pos, lookat, up, fov, lights, offset_T (from BaseCameraOptions) - entity_idx, link_idx_local, pos_offset, euler_offset (from RigidSensorOptionsMixin) Nyx-specific parameters are defined below. Parameters ---------- model : Literal Camera model: "pinhole". Default is "pinhole". spp : PositiveInt Samples per pixel for path tracing. Default is 16. denoise : bool Whether to apply denoising. Default is True. near : PositiveFloat Near clipping plane distance. Default is 0.1. far : PositiveFloat Far clipping plane distance. Default is 100.0. render_mode : ~gs_nyx.nyx_py_renderer.ERenderMode Rendering mode for Nyx. Default is :attr:`~gs_nyx.nyx_py_renderer.ERenderMode.FastPathTracer`. debug_view : ~gs_nyx.nyx_py_renderer.EDebugView Debug view mode for Nyx. Default is :attr:`~gs_nyx.nyx_py_renderer.EDebugView.Meshlet`. tone_mapper : ~gs_nyx.nyx_py_sdk.EToneMapper Tone mapper to apply post-render. Default is :attr:`~gs_nyx.nyx_py_sdk.EToneMapper.Reinhard`. anti_aliasing : ~gs_nyx.nyx_py_sdk.EAntiAliasing Anti-aliasing technique. Default is :attr:`~gs_nyx.nyx_py_sdk.EAntiAliasing.SMAA`. open_window : bool Whether to open a GUI window. Default is False. window_size : PositiveVec2IType Window size if open_window is enabled. Default is (1024, 1024). """ model_config = ConfigDict(arbitrary_types_allowed=True) # Nyx-specific rendering parameters model: Literal["pinhole"] = "pinhole" spp: PositiveInt = 16 denoise: bool = True near: PositiveFloat = 0.1 far: PositiveFloat = 100.0 render_mode: npr.ERenderMode = npr.ERenderMode.FastPathTracer debug_view: npr.EDebugView = npr.EDebugView.Meshlet tone_mapper: nps.EToneMapper = nps.EToneMapper.Reinhard anti_aliasing: nps.EAntiAliasing = nps.EAntiAliasing.SMAA # Window/export settings open_window: bool = False window_size: PositiveVec2IType = (1920, 1080) # Sensor manager integration update_ground_truth_only: bool = True # Nyx additional params env_maps: Annotated[tuple[nps.EnvironmentMapAsset, ...], Field(strict=False)] = () light_fields: Annotated[tuple[nps.LightFieldAsset, ...], Field(strict=False)] = () # Post-init validation.
[docs] def model_post_init(self, _): super().model_post_init(_) # We require far to be greater than near for valid depth range. if self.far <= self.near: gs.raise_exception("far must be greater than near")