Quickstart#
This guide assumes you already have a working Genesis simulation and want to swap its camera for a Nyx-rendered one. If you need a complete runnable script, see examples/01_hello_nyx.py.
Install the plugin first, see Installation.
1. Imports#
import gs_nyx.nyx_py_renderer as npr
import gs_nyx.nyx_py_sdk as nps
from gs_nyx_plugin.nyx_camera_options import NyxCameraOptions
2. Initialize Genesis#
Importing NyxCameraOptions registers the Nyx SDK’s start / stop pair with Genesis, so gs.init() boots the renderer for you and gs.destroy() (or interpreter teardown) tears it down.
gs.init()
scene = gs.Scene(show_viewer=False)
3. Replace your camera with a Nyx sensor#
Where you previously called scene.add_camera(...), call scene.add_sensor(NyxCameraOptions(...)) instead. All the intrinsics live on the options object — see NyxCameraOptions for the full field list and ERenderMode for the available render modes.
cam = scene.add_sensor(NyxCameraOptions(
res = (1280, 720),
pos = (-1.0, 1.0, 1.2),
lookat = (0.0, 0.0, 0.1),
fov = 40.0,
spp = 32,
render_mode = npr.ERenderMode.FastPathTracer,
))
To mount the camera on a robot link instead of a static pose, drop pos/lookat and pass entity_idx / link_idx_local / offset_T, see Attaching a camera.
4. Add a light#
Path-traced renders need a light source. A single directional (“sun”) LightAsset is the simplest (see ELightType for the full set of light types):
sun = nps.LightAsset()
sun.type = nps.ELightType.Directional
sun.directional_direction = (-0.4, -0.4, -0.8)
sun.color = (1.0, 1.0, 1.0)
sun.intensity = 5.0
cam = scene.add_sensor(NyxCameraOptions(
# ...intrinsics as above...
lights = (sun,),
))
5. Render and read frames#
A frame is produced every scene.step(). Pull the latest RGB buffer with cam.read().rgb, shape (n_envs, H, W, 3) uint8:
scene.build(n_envs=1)
scene.step()
rgb = cam.read().rgb[0].cpu().numpy() # (H, W, 3) uint8
For video, hand cam.read().rgb[0] to scene.start_recording(...), see examples/02_attached_camera.py.
Where to go next#
User guide, the user-guide landing page lists the runnable example scripts (camera attachment, lighting, materials, Genesis integration).
Concepts, the mental model behind scenes, assets, and renderer lifecycle.
API reference, exhaustive API reference.