BatchRenderer#
The BatchRenderer provides high-throughput parallel rendering optimized for large-scale reinforcement learning training with many parallel environments.
Overview#
The BatchRenderer is designed for:
Maximum throughput: Optimized for rendering thousands of environments
Parallel execution: Native support for batched simulation
RL training: Efficient observation generation for policy learning
GPU acceleration: Full GPU pipeline for minimal CPU overhead
Quick Start#
import genesis as gs
gs.init()
# Create scene with multiple environments
scene = gs.Scene()
scene.add_entity(gs.morphs.Plane())
robot = scene.add_entity(gs.morphs.URDF(file="robot.urdf"))
# Add batch renderer camera
cam = scene.add_camera(
res=(84, 84),
pos=(2, 0, 1),
lookat=(0, 0, 0.5),
)
# Build with parallel environments
scene.build(n_envs=1024)
# Training loop
for step in range(10000):
# Get batched observations
obs, _, _, _ = cam.render(rgb=True) # Shape: (n_envs, H, W, 3)
# Policy inference...
actions = policy(obs)
# Step all environments
scene.step()
Configuration#
The BatchRenderer is configured through BatchRendererOptions:
batch_options = gs.options.renderers.BatchRenderer(
# Configuration options
)
Output Format#
With n_envs > 1, camera outputs are batched:
Output |
Shape |
Description |
|---|---|---|
|
|
Batched RGB images |
|
|
Batched depth maps |
|
|
Batched segmentation |
Performance Tips#
Resolution: Use smaller resolutions (64x64 or 84x84) for RL
Render frequency: Render only when needed, not every step
GPU memory: Monitor VRAM usage with many environments
API Reference#
- 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#
Rasterizer - Standard rasterization renderer
gs.renderers.RayTracer - BatchRenderer options