Environment maps#
Environment maps provide image-based lighting (IBL) using an HDR image as both the visible background and the source of indirect illumination. They drive reflections, ambient colour, and global indirect light without requiring explicit light sources.
Environment maps are declared on a Nyx camera sensor via the env_maps field of NyxCameraOptions. The plugin collects them from every Nyx sensor at scene.build() and writes the union into the shared scene description.
Declaring an environment map#
An environment map is built by constructing an EnvironmentMapAsset, setting its texture and parameters, and passing it through env_maps:
import gs_nyx.nyx_py_sdk as nps
env_map = nps.EnvironmentMapAsset()
env_map.texture = "path/to/envmap.hdr"
env_map.layout = nps.EEnvMapLayout.LongLat
env_map.rotation = 30.0 # degrees
env_map.multiplier = 1.5
cam = scene.add_sensor(NyxCameraOptions(
res=(1280, 720),
pos=(2.0, -1.5, 2.0),
lookat=(0.0, 0.0, 0.9),
env_maps=(env_map,),
))
env_maps is a tuple. Multi-environment scenes use the tuple index to assign a different map to each Genesis env (see Per-environment selection).
Properties#
Property |
Type |
Description |
|---|---|---|
|
|
Path to an |
|
Image layout. |
|
|
|
Yaw rotation around the up axis, in degrees (radians in releases before |
|
|
Brightness multiplier applied to the HDRI values. |
|
|
Colour tint multiplied into the HDRI. When |
|
|
|
|
Size of the parallax box in world units. Only valid when |
|
|
Position inside the box from which the HDRI was captured. Only valid when |
|
|
World-space centre of the box. Only valid when |
Supported file formats#
Extension |
Status |
|---|---|
|
Supported (Radiance RGBE) |
|
Supported (OpenEXR) |
Solid-colour HDRI (default sky and how to override it)#
A Nyx scene with no environment map declared is not rendered against a black background. The renderer falls back to a flat mid-grey HDRI sky (RGB ≈ (0.5, 0.5, 0.5)) so unlit surfaces still receive ambient illumination and untouched scenes look reasonable out of the box. That fallback is convenient, but it is itself a light source: it contributes diffuse ambient and reflections to every PBR surface in the scene.
To replace the default sky with a different constant colour, attach an EnvironmentMapAsset with no texture and set tint to the colour you want. The renderer treats a texture-less asset as a uniform-radiance sky:
import gs_nyx.nyx_py_sdk as nps
# Pitch-black sky: kills the default grey ambient entirely, leaving the
# scene lit purely by the explicit `lights` on the camera.
black_sky = nps.EnvironmentMapAsset()
black_sky.tint = nps.float3(0.0, 0.0, 0.0)
cam = scene.add_sensor(NyxCameraOptions(
...,
env_maps = (black_sky,),
))
Use this whenever you need a clean, controllable lighting setup, for example when isolating the contribution of a single light, comparing materials under identical illumination, or generating synthetic data where ambient light would confound the labels. multiplier still applies, so a warm overcast wash can be expressed as tint = nps.float3(0.6, 0.55, 0.5) with multiplier tuned to taste.
Parallax correction#
An HDRI is normally treated as infinitely far away, which is right for skies but wrong for a map captured inside a room: reflections on a shiny floor do not line up with the walls. Setting parallax to Box tells the renderer to reproject every lookup onto an axis-aligned box that stands in for the room, so reflections and the visible background shift with the viewpoint as they would in the real space:
room = nps.EnvironmentMapAsset()
room.texture = "studio_capture.hdr"
room.parallax = nps.EEnvMapParallax.Box
room.parallax_box_extent = nps.float3(6.0, 3.0, 8.0) # room size
room.parallax_box_world_position = nps.float3(0.0, 1.5, 0.0) # room centre
room.parallax_box_capture_origin = nps.float3(0.0, 0.0, 0.0) # tripod position, box-local
The parallax_box_* properties raise RuntimeError when read or written while parallax is Off; set the mode first. Positions are given in the renderer’s coordinate frame as stored on the asset, which the plugin passes through unchanged.
Per-environment selection#
In a batched scene (scene.build(n_envs=N)), the env-map tuple is indexed by Genesis environment. Environment i renders with env_maps[i].
env_map_a = nps.EnvironmentMapAsset()
env_map_a.texture = "studio.hdr"
env_map_a.tint = nps.float3(0.6, 0.2, 0.1)
env_map_b = nps.EnvironmentMapAsset()
env_map_b.texture = "outdoor.exr"
env_map_b.tint = nps.float3(0.3, 0.8, 0.2)
env_map_b.multiplier = 0.8
cam = scene.add_sensor(NyxCameraOptions(
...,
env_maps=(env_map_a, env_map_b),
))
scene.build(n_envs=2)
The renderer selects each environment’s map itself while it renders the batch (see Sensor lifecycle); the plugin only exports the tuple at build time. Per-env HDRI domain randomisation therefore costs nothing per frame.
Lifecycle and constraints#
Warning
Environment maps are baked into the scene at scene.build(). The texture, layout, rotation, multiplier, tint and parallax* fields cannot be modified at runtime. To change the HDRI, rebuild the scene.
Note
A scene with no environment map and no explicit lights renders against Nyx’s default mid-grey HDRI sky as its only light source. The plugin emits a warning at build time, since this is rarely what you want: every PBR surface picks up the same flat grey ambient and the frame looks washed out. Add at least one light (see Lights), an HDRI environment map, or a solid-colour HDRI with a chosen tint to take control of the illumination.
Note
Procedural sun and sky generation is not supported. Use a captured HDRI or pair an EnvironmentMapAsset with a directional light.
See also#
Lights — Point / directional / spot light sources.
Gaussian splats — Gaussian splats.
Sensor lifecycle — When environment maps are uploaded and switched per env.