google-deepmind/mujoco/rendering
Claude Code and agent skill by google-deepmind/mujoco
- community
- ext:[{"type":"context","description":"Custom context provider definitions"}]
Checking that the SKILL.md file is still in the repository.
MuJoCo offscreen image rendering using mujoco.Renderer in Python and the MuJoCo C/C++ rendering pipeline (mjrContext, mjvScene, mjr_render, mjr_readPixels): RGB, metric depth maps, segmentation masks (mjtObj), MJCF offwidth/offheight framebuffer sizing, MUJOCO_GL (osmesa, egl), MuJoCo cameras (fixed, tracking, free, MjvCamera), and mjvOption flags/geomgroup. Use only for headless camera rendering, dataset recording, and visual observations in MuJoCo simulations. Don't use for generic OpenGL/EGL…
Install
npx vskill@latest install google-deepmind/mujoco/renderingSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as google-deepmind/mujoco/rendering.
MuJoCo Rendering: Cameras, Contexts & Offscreen Buffers
[!TIP]Official MuJoCo documentation (`doc/*.rst`): Read(.. _Rendering:,.. _FilamentRendering:,.. _ClassicRendering:) and(.. _Visualization:) directly when in a MuJoCo checkout; for largereference files like `../../python.rst` (.. _PyRender:),the literal.. _Label:anchor. Outside a checkout, the samedoc/*.rsttreeships offline inpip install mujocoatpathlib.Path(mujoco.__file__).parent / 'doc'; otherwise fetchhttps://mujoco.readthedocs.io/en/latest/<path>.html(or/en/stable/forreleased pages;functions.rstrenders insideAPIreference/APIfunctions.html, and Sphinx anchors lowercase the label,e.g... _PyRender:→#pyrender) and browse repo paths (../../../) underhttps://github.com/google-deepmind/mujoco/tree/main/.Related skills:- mujoco-python — Core physics simulation, stepping,and state management.- mujoco-studio — Interactive simulation, Studioviewer apps, and plugin architecture.- mujoco-gui — Dear ImGui UI design and custom controls.
1. Overview: Rendering Backends & Workflows
MuJoCo provides two built-in 3D rendering backends (compared side-by-side in programming/rendering.rst, .. _Rendering:):
- Classic OpenGL (`mujoco.Renderer` / C `mjr`): Immediate-mode OpenGL 1.5
renderer (mjv_updateScene -> mjr_render -> mjr_readPixels), now in maintenance mode. Bundled out of the box in pip install mujoco, making mujoco.Renderer the simplest single-class helper for headless RGB, depth, and segmentation capture. See programming/rendering.rst (.. _ClassicRendering:) and python.rst (.. _PyClassicRender:).
- Filament PBR (`mujoco.mjrf` & `mujoco.rendering.filament` / C `mjrf`):
Retained-mode, asynchronous physically-based renderer supporting OpenGL, Vulkan, Metal, and WebGL (owns its own headless or windowed GPU context and arbitrary-size mjrfRenderTarget buffers). Recommended for PBR materials, image-based/photometric lighting, and new C++/Studio applications; see §7 and programming/rendering.rst (.. _FilamentRendering:).
- Interactive Viewers (`mujoco.studio` / `mujoco.viewer`): Desktop or
web-streamed interactive viewers; use `mujoco-studio` instead.
2. Headless Contexts on Linux: MUJOCO_GL
On headless Linux systems (servers, containers), configure the OpenGL context provider via the MUJOCO_GL environment variable before importing `mujoco`:
Or from the command line:
3. The Python Renderer Class (RGB, Depth & Segmentation)
mujoco.Renderer manages GL context creation, scene geometry synchronization, and buffer readback. Always use it as a context manager:
Rendering Inside Simulation Loops
Creating a Renderer allocates GPU framebuffers. In RL or evaluation loops, create the renderer once outside the loop:
4. C++ Offscreen Rendering Pipeline (mjr & mjv)
In C++, offscreen rendering is performed using the mjvScene and mjrContext APIs:
5. Camera Definition & Placement
MuJoCo cameras look down their negative Z-axis:
- -Z: Viewing forward direction
- +X: Right
- +Y: Up
Defining Cameras in MjSpec
Free Camera (MjvCamera)
For custom interactive or orbital viewpoints:
6. Framebuffers & Scene Options
Offscreen Framebuffer Resolution
The offscreen rendering resolution cannot exceed the dimensions pre-allocated in the model. Adjust the buffer limit in the spec before compilation:
The Single <visual> Block Rule
MuJoCo uses only the last <visual> block defined in an XML file. Multiple visual blocks will silently overwrite earlier settings:
Geom Group Visibility & Visualization Flags
Control rendering layers via MjvOption:
7. Filament Physically-Based Rendering (mjrf)
MuJoCo's Filament backend (mjrfilament.h in C/C++, from mujoco import mjrf and mujoco.rendering.filament in Python) provides retained-mode PBR with OpenGL, Vulkan, Metal, and WebGL support, arbitrary mjrfRenderTarget sizes (independent of <global offwidth offheight/>), and asynchronous mjrfReadRequest pixel readback:
- Python (`ModelScene` + `Renderer`): Create an
mjrf.Context, bind
model lights and renderables once via mujoco.rendering.filament.model_scene.ModelScene, update in place with ms.update(data), and render into a NumPy target buffer via mujoco.rendering.filament.renderer.Renderer — see the complete example in python.rst (.. _PyFilamentRender:).
- C/C++ & CMake: Build with
-DMUJOCO_USE_FILAMENT=ON(or
-DMUJOCO_USE_FILAMENT_MJR_COMPAT=ON for drop-in mjr_ compatibility) and consult programming/rendering.rst (.. _reProgramming:, .. _reSupport:).
- Photometric light-intensity gotcha: If any
<light>has positive
intensity, Filament switches the entire scene from classic headlight + default environment lighting to photometric mode (turning off the headlight and darkening zero-intensity lights). For PBR materials, textures, and lighting authoring, read programming/rendering.rst (.. _reAuthoring:, .. _reMaterials:, .. _reLighting:) and inspect the reference PBR/IBL test scenes in ../../../test/render/testdata/ (pbr.xml, lighting.xml, emissive_bloom.xml, reflect_pbr.xml, ibl.ktx) and ../../../model/mug/mug.xml.
8. Common Gotchas & Best Practices
- GL context leaks: Always close
mujoco.Rendereror use awithblock.
Failing to free renderers in loops exhausts GL contexts.
- Destruction order: In C++,
mjr_freeContextmust be called before the
underlying OpenGL context is destroyed (see programming/rendering.rst, .. _reContext:).
- Buffer re-use:
renderer.render()returns an internal buffer view. Call
.copy() if storing frames in a list.
- Camera lookup by name: Pass
camera='camera_name'or the integer ID.
Avoid passing raw string IDs that are not present in the model.
9. Key References
Documentation
(.. _Rendering:, .. _FilamentRendering:, .. _ClassicRendering:)
(.. _Visualization:, .. _viCamera:, .. _viOption:)
- Python Rendering Bindings (
.. _PyRender:,
.. _PyFilamentRender:, .. _PyClassicRender:)
(.. _visual-global:, .. _body-camera:), Modeling Cameras (.. _CCamera:), and MuJoCo Menagerie (.. _Menagerie:)
(.. _Visualization-api:, .. _OpenGLrendering:, .. _FilamentRenderingApi:) and C++ Render Sample (.. _saRender:)
Source Code & Model Examples
- C API Headers and
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingdoc/skills/rendering/SKILL.md
Popularity
- Repository stars
- 15,396
- Repository forks
- 1,789
- 7-day trend score
- 48
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
contextCustom context provider definitions
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/google-deepmind/mujoco/rendering)