Principle:Google deepmind Mujoco Offscreen Rendering
| Knowledge Sources | |
|---|---|
| Domains | Rendering, Computer_Vision, OpenGL |
| Last Updated | 2026-02-15 06:00 GMT |
Overview
Technique for rendering simulation frames to an off-screen buffer for pixel capture without displaying a window.
Description
Offscreen Rendering allows capturing RGB and depth images from MuJoCo simulations without a display. This is essential for headless servers, dataset generation, video recording, and vision-based reinforcement learning. MuJoCo supports three offscreen backends: EGL (GPU-accelerated, Linux), OSMesa (software, cross-platform), and GLFW hidden window (GPU, cross-platform). The offscreen framebuffer is managed by mjrContext and pixels are read back with mjr_readPixels.
Usage
Use this principle for headless rendering, video recording, generating training datasets for computer vision, or vision-based RL observations. Choose EGL for GPU-accelerated headless rendering on Linux servers.
Theoretical Basis
Offscreen rendering uses the same OpenGL pipeline as on-screen but targets a Framebuffer Object (FBO):
- Buffer selection: Switch to offscreen FBO via mjr_setBuffer(mjFB_OFFSCREEN)
- Viewport query: Get maximum offscreen resolution via mjr_maxViewport
- Render: Normal mjr_render call (targets offscreen FBO)
- Readback: mjr_readPixels copies pixel data from GPU to CPU memory
- Process: RGB and/or depth arrays are available for saving or processing