gazebosim / gz-common

An audio-visual library supports processing audio and video files, a graphics library can load a variety 3D mesh file formats into a generic in-memory representation, and the core library of Gazebo Common contains functionality that spans Base64 encoding/decoding to thread pools.
https://gazebosim.org
Apache License 2.0
15 stars 39 forks source link

Fix loading lightmaps from gltf / glb meshes #630

Closed iche033 closed 2 months ago

iche033 commented 2 months ago

🦟 Bug fix

Summary

Fix loading gltf / glb mesh files with lightmaps. Needed by the Ionic demo world.

Currently the lightmap is ignored if there's a combined roughness + metalness texture. This PR fixes the problem by loading the lightmap (ambient occlusion data) from the roughness + metalness texture.

Tested with a few gltf sample models (water bottle, barramundi fish, damaged helmet)

Here are screenshots of the BarramundiFish before (left) and after (right) the change. I removed the albedo map to better visualize the effect of the lightmap:

barramundi_no_lightmap barramundi_lightmap

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.

iche033 commented 2 months ago

Some tests in UNIT_AssimpLoader_TEST on hombrew are failing. I noticed that they are failing in main as well and could be due to a new AssimpLoader homebrew bottle. I ticketed an issue for it: https://github.com/gazebosim/gz-common/issues/633

iche033 commented 2 months ago

Fixed homebrew CI in https://github.com/gazebosim/gz-common/pull/634