Web-based MuJoCo viewer powered by viser.
Project description
mjviser
A web-based MuJoCo viewer built on Viser.
Quick start
Run it directly with uvx (nothing to install):
uvx mjviser path/to/model.xml
Or pip install mjviser and run mjviser path/to/model.xml.
mjviser also does fuzzy path matching against the current directory:
mjviser humanoid # finds **/humanoid*.xml
mjviser shadow_hand # finds **/shadow_hand*.xml
If robot_descriptions is available, you can load any of its 57 MuJoCo models by name:
uvx --with robot_descriptions mjviser go1
[!NOTE]
uvxdefaults to the system Python and may not respectrequires-pythonconstraints (astral-sh/uv#8206). If your system Python is 3.14+, where MuJoCo can't build yet, pass-p 3.13explicitly:uvx -p 3.13 mjviser path/to/model.xml.
Python API
import mujoco
from mjviser import Viewer
model = mujoco.MjModel.from_xml_path("robot.xml")
data = mujoco.MjData(model)
Viewer(model, data).run()
Open the printed URL in your browser. You get most of what the native MuJoCo viewer offers: simulation controls, joint and actuator sliders, contact and force visualization, camera tracking, keyframes, and more.
Extension points
Viewer accepts three optional callbacks:
step_fn(model, data): called each simulation step. Defaults tomujoco.mj_step.render_fn(scene): called each render frame. Defaults toscene.update_from_mjdata(data).reset_fn(model, data): called on reset.
For full control, use ViserMujocoScene directly. The server is a standard Viser server, so you can add GUI elements, scene overlays, or anything else Viser supports.
server = viser.ViserServer()
scene = ViserMujocoScene(server, model, num_envs=1)
scene.create_visualization_gui()
with server.gui.add_folder("My Controls"):
slider = server.gui.add_slider("Force", min=0, max=100, initial_value=0)
while True:
mujoco.mj_step(model, data)
scene.update_from_mjdata(data)
Examples
active_viewer.py: simplest usage with playback controlsactive_viewer_with_controller.py: customstep_fnwith random torquespassive_viewer.py: manual simulation loop withViserMujocoScenemulti_env.py: 4 humanoids in parallel via mujoco-warpghost_overlay.py: customrender_fnthat overlays a time-delayed ghostmotion_playback.py: recorded trajectory with timeline scrubber, speed control, and contact replay
Acknowledgments
Thanks to Matija Kecman for early feedback and suggestions.
Limitations
- No mouse interaction: clicking/dragging bodies and keyboard callbacks require upstream Viser support.
- Many-body performance: models with 60+ independently-moving bodies can be slower than the native viewer due to per-body websocket overhead.
- Cubemap textures: approximated via per-vertex colors rather than true cubemap rendering.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mjviser-0.0.8.tar.gz.
File metadata
- Download URL: mjviser-0.0.8.tar.gz
- Upload date:
- Size: 26.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7c5e32d343bf6854d4f09ef6a0de759e86af45cf1c0c3c72ca96dff2f13425d
|
|
| MD5 |
df3de304da5e6269cfb71c6a157483b4
|
|
| BLAKE2b-256 |
b0d13ee6b143333059e4c72a01e267502ea220324467d8717c884c0d7f2ea25a
|
File details
Details for the file mjviser-0.0.8-py3-none-any.whl.
File metadata
- Download URL: mjviser-0.0.8-py3-none-any.whl
- Upload date:
- Size: 29.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51d31146e9187bbd587ec84f231ddad08506e4b6456f3f3de372529b2c728dc6
|
|
| MD5 |
7d04170a266220342a28d2ba2b39fa12
|
|
| BLAKE2b-256 |
1308eb590ff2ac31be7289707718aeda06f1fbf8c11d23e5a7927e941b4efc98
|