google-deepmind / google-deepmind/mujoco

Rendering: Same performance results for egl and mesa

Open
#2,090 3 comments 0 reactions 1 assignee Claimed by @saran-t View on GitHub
bug
Dominant language
C++
Stars
15.2k
Forks
1.8k
Avg merge
10d 16h
Merged PRs (30d)
25

Description

### Intro

Hi there, I am using mujoco in a basic simulation setup (a single ball that is moved in the y-z plain using a parallel gripper).

### My setup

I am rendering a mujoco scene on a server with Ubuntu 24.04 Server installed. The server has a NVidia GPU attached. I managed to get the rendering to work for egl and mesa, where I am rendering to a virtual X server spawned via `xvfb-run`.

### What's happening? What did you expect?

The speed for rendering with `%env MUJOCO_GL=eql` is the same than with `%env MUJOCO_GL=mesa` and `%env MUJOCO_GL=osmesa`. I would the speed to be quite different. Does someone has an idea why this could be the case?

Note that when I set the environment variable to something else like:

```
import os
os.environ['MUJOCO_GL']='foo'
```

this still seems to work (no error when importing mujoco). I wonder therefore if the setting is picked up at all.

### Steps for reproduction

See code and setup described above. See how I managed to get mesa to work on this issue: https://github.com/KyberRobot. https://github.com/google-deepmind/mujoco/issues/2053#issuecomment-2374457491

### Minimal model for reproduction

```








```

### Code required for reproduction

Code (run from jupyter lab, kernel spawned using `xvfb-run -a python ...`):

```
import os
os.environ['MUJOCO_GL']='egl'

import time
import matplotlib.pylab as plt

import mujoco
from mujoco import viewer

model = mujoco.MjModel.from_xml_path('model/scene.xml')
data = mujoco.MjData(model)
renderer = mujoco.Renderer(model)

tic = time.time()
for i in range(100):
mujoco.mj_step(model, data)
renderer.update_scene(data)
pixels = renderer.render()
print(f"{time.time() - tic:.2f} s") # Prints around 1.63 s for mesa and egl
```

### Confirmations

- [X] I searched the [latest documentation](https://mujoco.readthedocs.io/en/latest/overview.html) thoroughly before posting.
- [X] I searched previous [Issues](https://github.com/google-deepmind/mujoco/issues) and [Discussions](https://github.com/google-deepmind/mujoco/discussions), I am certain this has not been raised before.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.