NyxPyRenderer#

class gs_nyx_plugin.nyx_renderer.NyxPyRenderer[source]#

Bases: object

Python-side wrapper around the native Nyx renderer.

Imports the GPU buffers the Nyx renderer exports (see gs_nyx.nyx_external_memory) and writes Genesis simulation state (rigid transforms, deformable vertex positions, camera poses) straight into them, then drives the per-frame render. End users typically interact with the renderer indirectly via NyxCameraSensor; this class is exposed for advanced use cases that need to drive the renderer manually.

Coordinate convention#

Genesis is Z-up, Nyx is Y-up. Static scene data is converted on the CPU at export time by NyxSceneExporter; per-frame transforms are uploaded as raw Genesis-space (Z-up, WXYZ) values and converted on the GPU.

Lifecycle#

  1. Construct with the scene, exported scene-description path, and max viewport size.

  2. Call build() once after the Genesis scene has been built, passing the entity-to-UUID mapping from NyxSceneExporter. This starts the renderer, loads the scene, and allocates GPU buffers sized to the current geometry counts.

  3. Each frame: update() (window event loop and animation clock), update_scene() once for every environment, then render_all() once. The images of camera c for all envs are the (n_envs, H, W, 3) view returned by camera_image().

  4. destroy() releases the native renderer and GPU buffers.

Multi-environment batching#

All per-frame interop tensors carry a leading env dimension and alias Nyx’s own buffers, so writing a frame is one batched copy followed by a single compute/graphics synchronization. Nyx then renders every (env, camera) pair itself into the packed color buffer the views of camera_image() alias, so the per-env cost includes no Python work, compute sync, or memcpy.

Every tensor the renderer hands out lives on device, the torch device paired with the GPU Nyx renders on, whichever compute API (CUDA or HIP) the torch build drives it with.

Constructors

Methods

build

Start the native renderer and allocate all GPU buffers.

camera_image

Return the (B, H, W, 3) uint8 GPU view holding the last rendered images of a camera.

destroy

Shut down the native renderer and release the interop buffers.

pick_pixel

Cast a ray through one pixel and return the entity and hit point.

render

Return one camera's image for one env, rendering the batch first if needed.

render_all

Render every (env, camera) pair and return the per-camera image batches.

unload_scene

Release the loaded scene without shutting down the renderer.

update

Drive the native renderer's per-frame tick (window + animation clock).

update_camera_tensor

Write one camera pose, shared by every env, into the camera buffers.

update_camera_tensors_batched

Write one camera's per-env poses into the camera buffers in a single batched op.

update_scene

Sync every Genesis environment's state to the Nyx GPU buffers in one upload.

Attributes

device

The torch device paired with the GPU Nyx renders on; available once build() ran.