MuJoCo · Genesis · Apache-2.0

PhysicalAI Sim2Real Camera

Make your simulator's camera behave like the real one on your robot,
with physical knobs fitted from real-camera captures

Real RGB and depth camera data on one side, MuJoCo and Genesis on the other, joined by a sim-to-real camera pipeline

01Problem

A simulator camera draws one ideal instant of the scene. The camera on a robot does not: its lens distorts and vignettes, its sensor adds noise and auto exposure, the image smears with motion and skews under a rolling shutter, depth has holes and flying pixels, and frames arrive late, jittered and sometimes not at all. A policy trained on ideal renders meets all of this for the first time on the real robot.

A calibration fixes the geometry once, but latency, rolling shutter and motion blur change with every frame and every head motion, and noise, exposure and drops come from the sensor and the transport. No calibration step removes them; they have to be handled, and that handling can be developed in simulation.

02What it models

Every effect is identity by default, and nearly every parameter is a physical knob. The image pipeline does not depend on the simulator: MuJoCo and Genesis are supported, and any other renderer only has to hand over its frames.

StageEffects
OpticsBrown-Conrady distortion with a margin render, vignetting or measured flat field, depth of field, lens / OLPF blur
Exposure & sensorEV offset, auto exposure and white balance with time constants, shot / read noise, PRNU / DSNU, Bayer mosaic, gamma, quantisation
TemporalMotion blur over the exposure window, rolling shutter by readout band, camera-mount vibration
DepthEdge holes and flying pixels, z²-scaled axial noise, minimum and maximum range
TimingFrame rate and phase, latency, Gamma-distributed jitter, frame drops, sample-and-hold delivery to the control loop
EnvironmentColour matrix, mains-light flicker under a rolling shutter, lens dust and veiling glare, scene lighting and walkers
Ideal render next to the realistic pipeline output
Ideal render next to the realistic pipeline output: Unitree G1 head camera and a calibration board.

Why a post-process, not a plugin

Motion blur and rolling shutter need several instants inside one exposure, which only a layer around the renderer can provide. MuJoCo sensor plugins cannot render, and Genesis camera sensors refuse delay and jitter.

One config, every simulator

The camera is described by an MJCF camera in every case, so one CameraConfig means the same camera in MuJoCo and in Genesis, and a fitted config drives both.

03Measured performance

RTX 5080, idle GPU.

0.3 ms

per 640×480 frame on the MuJoCo GPU path, GL colour buffer taken straight into CUDA

0.34 ms

per camera with 64 cameras batched on one renderer (≈ 22 ms in total)

1.1 ms

per environment at 256 batched Genesis environments with the Madrona renderer, frames kept on the GPU

PathWhenMeasured
MuJoCo, CPUone camera, no torch in the process≈ 3.2 ms / frame
MuJoCo, GPUthe frame goes to a CUDA policy anyway≈ 0.3 ms / frame
MuJoCo, virtual sensora GL-only sim process exports frames by dma-buf to a CUDA effects process, published on an axon zero-copy topicthree processes
Genesis, batched (OpenGL)G1 window mode, 13 sub-renders + depth7.2 ms / env at 16 envs
Genesis, Madronalarge batches, every env in one GPU pass1.12 ms / env at 256 envs

04Agreement between simulators

The same camera config in MuJoCo and Genesis gives the same images up to the renderers' own shading, measured on the WIRobotics ALLEX head camera and a Unitree G1:

CheckResult
Motion blur + rolling shutter silhouettes, G1 yawing at 2.5 rad/sIoU median 0.995, centroid 0.46 px
Checkerboard K / D recovered through each pipelinefx / fy within 0.14 %, corners within 0.70 px
Depth on targetsmedian difference 0.15 mm
Physics with the Genesis camera on vs offidentical trajectories

05Calibrating against a real camera

Calibrated preset

Use your K, D and mount; everything a calibration does not reach is on at typical values and can be randomised, including per-episode mount perturbation.

Full fit

One capture session (checkerboard, flat and dark fields, grey chart, noise stack, LED blink) becomes a camera_config.json plus its uncertainty, validated by fitting synthetic captures back to a known config.

Online observer

Keeps estimating K, noise and latency while the robot moves; in MuJoCo across 20 seeds: focal length 0.3 %, principal point 2.3 px, latency 2 ms, every |error| / σ ≤ 3.

python scripts/calibrate.py calib_data --out camera_config.json --report calib_report

06White paper

Realistic Cameras for Genesis →

What the Genesis backend adds on top of Genesis, how the mirror-scene rendering works, where it agrees with MuJoCo and what it does not support, with figures and videos on Unitree G1, WIRobotics ALLEX and Apptronik Apollo.

07Quickstart

from physicalai_sim2real_camera import CameraConfig, CameraStream, SimCamera

cfg = CameraConfig(640, 480, dist=(-0.3, 0.1, 0.001, -0.001, 0.0), vignette=1.0,
                   sigma_shot=0.02, sigma_read=0.005, gamma=2.2,
                   fps=30, latency_s=0.05, jitter_k=2, jitter_theta=0.005, drop_prob=0.05)
cam = SimCamera(model, "cam", cfg)      # wraps a mujoco.Renderer
rgb, z = cam.render(data, depth=True)   # what the real camera would deliver
stream = CameraStream(cam, cfg)         # fps / latency / jitter / drops, driven by sim time

RGB and depth are complete through calibration, the GPU and batch paths, the virtual sensor and the online observer in MuJoCo; the Genesis backend agrees within the numbers above. Next: real recordings of the target camera through the observer, and further simulators through the same ingest entry point.