Fix glTF metalness and roughness map orientation #532
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🦟 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:
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
codecheck
passed (See contributing)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.