gs.renderers.BatchRenderer#
A high-throughput renderer that renders many parallel environments together on the GPU, for large-scale data collection and reinforcement-learning observation generation. Enable it with gs.Scene(renderer=gs.renderers.BatchRenderer(use_rasterizer=True)); set use_rasterizer=False to path-trace instead. It requires the gs-madrona package.
With n_envs > 1, camera outputs gain a leading batch dimension, for example rgb with shape (n_envs, height, width, 3). For installation and a runnable example, see Rendering.
Unlike the rasterizer, the batch renderer takes its lights at runtime through scene.add_light(...) after the scene is created, rather than from VisOptions:
scene.add_light(
pos=(0.0, 0.0, 10.0), # position, used for positional lights
dir=(0.0, 0.0, -1.0), # direction the light travels, normalized internally
color=(1.0, 1.0, 1.0), # RGB, each channel in [0, 1]
intensity=1.0,
directional=True, # parallel rays if True, positional if False
castshadow=True,
cutoff=45.0, # spotlight cutoff angle, degrees
attenuation=0.0, # distance falloff for positional lights
)
Options#
Implementation#
- class genesis.vis.batch_renderer.BatchRenderer(visualizer, renderer_options, vis_options)[source]#
Bases:
RBCThis class is used to manage batch rendering
- render(rgb=True, depth=False, segmentation=False, normal=False, antialiasing=False, force_render=False)[source]#
Render all cameras in the batch.
- Parameters:
rgb (bool, optional) – Whether to render the rgb image.
depth (bool, optional) – Whether to render the depth image.
segmentation (bool, optional) – Whether to render the segmentation image.
normal (bool, optional) – Whether to render the normal image.
antialiasing (bool, optional) – Whether to apply anti-aliasing.
force_render (bool, optional) – Whether to force render the scene.
- Returns:
rgb_arr (tuple of arrays) – The sequence of rgb images associated with each camera.
depth_arr (tuple of arrays) – The sequence of depth images associated with each camera.
segmentation_arr (tuple of arrays) – The sequence of segmentation images associated with each camera.
normal_arr (tuple of arrays) – The sequence of normal images associated with each camera.
- property lights#
- property cameras#
- property seg_idxc_map#
See also#
gs.renderers.Rasterizer: the standard single-scene rasterizer
Examples: rendering observations for RL