unilab.visualization.render_many¶
MuJoCo-only batched rendering helpers.
This module renders many MuJoCo states into image frames by constructing MuJoCo model/data/renderer objects inside worker processes. It is not available for Motrix-only workflows.
Functions
|
|
|
Initialize MuJoCo-only rendering context for a worker process. |
|
Worker function to render a single frame. args: (state_batch, offsets, transparent, cam_distance, cam_elevation, cam_azimuth, cam_lookat, marker_positions) marker_positions: optional (num_envs, 3) world-frame positions for overlay spheres. |
Render a single frame with camera tracking on the primary env's root body. |
|
|
Render a list of physics states and return the list of frames. |
|
Render with camera tracking on a single primary environment. |
|
Render a list of physics states to a video file using parallel processing. |
- unilab.visualization.render_many.init_worker(model_path, shape)[source]¶
Initialize MuJoCo-only rendering context for a worker process.
- unilab.visualization.render_many.render_frame_job(args)[source]¶
Worker function to render a single frame. args: (state_batch, offsets, transparent, cam_distance, cam_elevation, cam_azimuth,
cam_lookat, marker_positions)
marker_positions: optional (num_envs, 3) world-frame positions for overlay spheres.
- unilab.visualization.render_many.render_states_get_frames(state_list, model_path, width=1280, height=720, num_processes=8, camera_id=-1, cam_distance=2.0, cam_elevation=-20, cam_azimuth=90, cam_lookat=None, render_spacing=1.0, marker_positions_list=None)[source]¶
Render a list of physics states and return the list of frames.
- Parameters:
state_list – List of numpy arrays, each shape (num_envs, state_dim).
model_path – Path to the mujoco XML model file.
width – Width of the video.
height – Height of the video.
num_processes – Number of parallel processes to use.
camera_id – Camera ID to render from.
cam_distance – Camera distance from lookat point.
cam_elevation – Camera elevation angle in degrees.
cam_azimuth – Camera azimuth angle in degrees.
cam_lookat – Optional [x, y, z] lookat override for the free camera.
render_spacing – Grid spacing used to offset each env in composed video frames.
marker_positions_list – Optional list of (num_envs, 3) arrays for overlay spheres.
- Returns:
List of numpy arrays (H, W, 3) (RGB)
- unilab.visualization.render_many.render_frame_tracking_job(args)[source]¶
Render a single frame with camera tracking on the primary env’s root body.
The camera uses
mjCAMERA_TRACKINGso it follows the robot each frame. Only the primary env + nearest neighbours are rendered.
- unilab.visualization.render_many.render_states_get_frames_tracking(state_list, model_path, width=1280, height=720, tracking_env_idx=0, max_extra_envs=2, cam_distance=2.0, cam_elevation=-20, cam_azimuth=90, render_spacing=1.0, marker_positions_list=None)[source]¶
Render with camera tracking on a single primary environment.
Only the primary env and its nearest neighbours are shown. The camera follows the root body of the primary env each frame (
mjCAMERA_TRACKING).- Parameters:
state_list – List of numpy arrays, each shape (num_envs, state_dim).
model_path – Path to the mujoco XML model file.
tracking_env_idx – Index of the primary environment to track.
max_extra_envs – Number of nearest-neighbour envs to render alongside.
cam_distance – Camera distance from the tracked body.
cam_elevation – Camera elevation angle in degrees.
cam_azimuth – Camera azimuth angle in degrees.
render_spacing – Grid spacing for env layout.
- unilab.visualization.render_many.render_states_to_video(state_list, model_path, output_path, fps=30, width=1280, height=720, num_processes=8, cam_distance=2.0, cam_elevation=-20, cam_azimuth=90, cam_lookat=None, render_spacing=1.0)[source]¶
Render a list of physics states to a video file using parallel processing.