Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix glTF metalness and roughness map orientation #532

Merged
merged 2 commits into from
Aug 31, 2023

Conversation

iche033
Copy link
Contributor

@iche033 iche033 commented Aug 29, 2023

🦟 Bug fix

Summary

glb file packs the metalness and roughness maps (grayscale) in a single texture (in the R and G channels) and our Assimp loader splits them out into individual textures for use in gz-rendering. However, the texture data are written out incorrectly (rotated by 90 degrees). This PR fixes that logic.

For testing, I'm using the water bottle glb file from: https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/WaterBottle. You can see a screenshot of what the water bottle supposed to look like in that page.

Here're screenshots in gazebo showing before and after the fix:

Before:
glb_before

After:
glb_after

Side note, with default lighting params in Gazebo, the bottle appears a lot darker than expected . In the screenshot above, I had to change the dir light diffuse and specular colors to [1.0 1.0 1.0] and intensity to 2.0 to get the water bottle to be brighter

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

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.

Signed-off-by: Ian Chen <[email protected]>
@iche033 iche033 requested a review from marcoag as a code owner August 29, 2023 18:33
@github-actions github-actions bot added 🌱 garden Ignition Garden 🎵 harmonic Gazebo Harmonic labels Aug 29, 2023
@codecov
Copy link

codecov bot commented Aug 29, 2023

Codecov Report

Merging #532 (98ec53e) into gz-common5 (6e2444f) will not change coverage.
The diff coverage is 0.00%.

❗ Current head 98ec53e differs from pull request most recent head ade65d4. Consider uploading reports for the commit ade65d4 to get more accurate results

@@             Coverage Diff             @@
##           gz-common5     #532   +/-   ##
===========================================
  Coverage       83.65%   83.65%           
===========================================
  Files              90       90           
  Lines           10249    10249           
===========================================
  Hits             8574     8574           
  Misses           1675     1675           
Files Changed Coverage Δ
graphics/src/AssimpLoader.cc 89.21% <0.00%> (ø)

@azeey azeey added the beta Targeting beta release of upcoming collection label Aug 30, 2023
@mjcarroll mjcarroll merged commit e18906b into gz-common5 Aug 31, 2023
9 of 10 checks passed
@mjcarroll mjcarroll deleted the gltf_split_metal_rough branch August 31, 2023 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta Targeting beta release of upcoming collection 🌱 garden Ignition Garden 🎵 harmonic Gazebo Harmonic
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants