NyxPyRenderer#
- class gs_nyx_plugin.nyx_renderer.NyxPyRenderer[source]#
Bases:
objectPython-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 viaNyxCameraSensor; 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#
Construct with the scene, exported scene-description path, and max viewport size.
Call
build()once after the Genesis scene has been built, passing the entity-to-UUID mapping fromNyxSceneExporter. This starts the renderer, loads the scene, and allocates GPU buffers sized to the current geometry counts.Each frame:
update()(window event loop and animation clock),update_scene()once for every environment, thenrender_all()once. The images of cameracfor all envs are the(n_envs, H, W, 3)view returned bycamera_image().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
Construct the renderer wrapper.
Methods
Start the native renderer and allocate all GPU buffers.
Return the
(B, H, W, 3)uint8 GPU view holding the last rendered images of a camera.Shut down the native renderer and release the interop buffers.
Cast a ray through one pixel and return the entity and hit point.
Return one camera's image for one env, rendering the batch first if needed.
Render every (env, camera) pair and return the per-camera image batches.
Release the loaded scene without shutting down the renderer.
Drive the native renderer's per-frame tick (window + animation clock).
Write one camera pose, shared by every env, into the camera buffers.
Write one camera's per-env poses into the camera buffers in a single batched op.
Sync every Genesis environment's state to the Nyx GPU buffers in one upload.
Attributes