gazebosim / gz-mujoco

25 stars 4 forks source link

MJCF to SDFormat: Stop setting the emissive component of material from rgba #76

Closed azeey closed 2 years ago

azeey commented 2 years ago

🦟 Bug fix

Summary

Currently, the rgba attribute of a geom is used to set all the color components of material including emissive, but this doesn't produce the expected result. Given the following MJCF file

<mujoco>
  <visual>
    <headlight ambient="0 0 0" diffuse="0 0 0" specular="0 0 0"/>
  </visual>
  <worldbody>
    <body name="base">
      <geom type="box" size="1 1 1" rgba="0 1 0 1"/>
    </body>
  </worldbody>
</mujoco>

The resulting geometry has the following material

          <material>
            <ambient>0 1 0 1</ambient>
            <diffuse>0 1 0 1</diffuse>
            <specular>0 1 0 1</specular>
            <emissive>0 1 0 1</emissive>
          </material>

Simulating this in Mujoco shows a dark screen since the headlight (default light) is set to "0 0 0". However, in gz-sim (after setting the background and ambient colors to black), the box is still displayed:

image

So I think it's best if we left out setting the emissive component from the rgba attribute.

Checklist

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

codecov[bot] commented 2 years ago

Codecov Report

Merging #76 (2861b20) into main (4e02950) will not change coverage. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main      #76   +/-   ##
=======================================
  Coverage   98.84%   98.84%           
=======================================
  Files          21       21           
  Lines        1992     1992           
=======================================
  Hits         1969     1969           
  Misses         23       23           
Impacted Files Coverage Δ
...mjcf_to_sdformat/test_add_mjcf_worldbody_to_sdf.py 99.53% <100.00%> (ø)
...ests/mjcf_to_sdformat/test_mjcf_material_to_sdf.py 98.48% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 4e02950...2861b20. Read the comment docs.