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
withrgba = (0.5, 0.5, 0.5, 1)
(a non-white color). - Geom B uses material
MB
withrgba = (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:
- Are all input/output colors (including textures) treated as linear RGB?
- 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
<mujoco>
<visual>
<headlight active="0" />
</visual>
<asset>
<texture name="test" type="2d" file="test.png" />
<material name="test" texture="test" rgba="1 1 1 1" specular=".5" />
<material name="test2" rgba="0.4980392156862745 0.4980392156862745 0.4980392156862745 1" specular=".5" />
</asset>
<worldbody>
<light directional="true" ambient="0.8 0.0 0.0" diffuse="1 1 1" specular="0.0 0.0 0.0" pos="0 0 5" dir="0 0 -1"/>
<geom type="plane" size="0.1 0.1 1" pos="-0.1 -0.1 0" material="test"/>
<geom type="plane" size="0.1 0.1 1" pos=" 0.1 0.1 0" material="test"/>
<geom type="plane" size="0.1 0.1 1" pos=" 0.1 -0.1 0" material="test2"/>
<geom type="plane" size="0.1 0.1 1" pos="-0.1 0.1 0" material="test2"/>
</worldbody>
</mujoco>
Code required for reproduction
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
- I searched the latest documentation thoroughly before posting.
- I searched previous Issues and Discussions, I am certain this has not been raised before.