google-deepmind / google-deepmind/mujoco
Inconsistent Lighting Behavior Between Textured and Untextured Geoms
- Dominant language
- C++
- Stars
- 15.2k
- Forks
- 1.8k
- Avg merge
- 10d 16h
- Merged PRs (30d)
- 25
Description
### Intro
Hi!
I am a graduate student at HKU, I use MuJoCo for my research on robotic manipulation.
### My setup
MuJoCo 3.3.0, Python, Linux
### What's happening? What did you expect?
When comparing two geoms, `A` and `B`, under MuJoCo's `GL_MODULATE` setting:
- **Geom A** uses material `MA` with `rgba = (0.5, 0.5, 0.5, 1)` (a non-white color).
- **Geom B** uses material `MB` with `rgba = (1, 1, 1, 1)` and applies a **pure-color texture** `(0.5, 0.5, 0.5, 1)`.
Under diffuse lighting, both geoms render the same color, as expected. However, when `ambient` or `specular` lighting is introduced:
- **Geom A**'s rendered color changes according to ambient/specular intensity.
- **Geom B**'s rendered color remains **invariant** to ambient/specular lighting.
This inconsistency makes it impossible to seamlessly transition between textured and untextured faces under non-diffuse lighting.
### Additional Clarification Request: Color Space Handling
OpenGL's Fixed Function Pipeline (FFP) operates in **linear RGB** unless explicitly configured otherwise (e.g., via `GL_SRGB8_ALPHA8` or `GL_FRAMEBUFFER_SRGB`). Since MuJoCo does not appear to enable either:
1. Are all input/output colors (including textures) treated as **linear RGB**?
2. If textures are typically authored in **sRGB**, does the lack of gamma correction lead to incorrect brightness after lighting?
I would appreciate any corrections or insights into these behaviors.
### Steps for reproduction
Run script to generate textuer, then launch model.
### Minimal model for reproduction
```XML
```
### Code required for reproduction
```python
import PIL.Image
import numpy as np
image_array = np.zeros((16, 16, 3), dtype=np.uint8)
image_array[...] = (0x7F, 0x7F, 0x7F)
PIL.Image.fromarray(image_array).save("test.png")
```
### 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
Assessment
This issue has not been assessed yet.