-
Notifications
You must be signed in to change notification settings - Fork 42
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 / glb root node transform #543
Conversation
Signed-off-by: Ian Chen <[email protected]>
@luca-della-vedova do you still remember the meshes that you were having the rotation issue with? I should probably also test them to make sure they still work |
Signed-off-by: Ian Chen <[email protected]>
Codecov Report
@@ Coverage Diff @@
## gz-common5 #543 +/- ##
==============================================
+ Coverage 83.64% 83.66% +0.01%
==============================================
Files 90 90
Lines 10243 10252 +9
==============================================
+ Hits 8568 8577 +9
Misses 1675 1675
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add a test to UpdatedRootNodeTransform
?
Very interesting, thanks for the fix! |
Signed-off-by: Ian Chen <[email protected]>
After testing with different glb meshes, I found that most of the code from the workaround is actually not needed so I simplified the fix quite a bit in 8b0d752. The current AssimpLoader tests has code to load glTF / glb meshes and should now cover all of the the new code (coverage). |
ah ok I see! The changes in this PR should only affect glTF / glb meshes and not daes so I think we should be fine here. |
Signed-off-by: Ian Chen <[email protected]>
added one more test to verify that the glb mesh's vertices are correct. 9b533c8 |
🦟 Bug fix
Summary
There is a long standing issue in assimp on models having incorrect rotations: assimp/assimp#849.
Currently, our assimp loader drops the root node transform (setting it to identity) to work around the issue. However, this caused other assets's rotation to be appear incorrect and inconsistent with other rendering / modeling tools. This PR adapts a another workaround posted in assimp/assimp#849 to fix the root node transform for glTF / glb meshes.
Update as of 40c7bbb - Changes should how only affect glTF / glb and kept the same behavior for other file formats like dae.
Here are tests with a couple of glb meshes in gazebo and other tools. The camera in Gazebo is set up to have the same orientation as the these tools (Y up, facing -X)
WaterBottle
Gazebo Before (ignore the black seam at the front, it's clipped by camera's near clip plane):
![WaterBottle_before](https://private-user-images.githubusercontent.com/4000684/275064764-a5f56ca1-0549-458a-ad7f-dc5a579c5f22.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NjIxMzAsIm5iZiI6MTczOTU2MTgzMCwicGF0aCI6Ii80MDAwNjg0LzI3NTA2NDc2NC1hNWY1NmNhMS0wNTQ5LTQ1OGEtYWQ3Zi1kYzVhNTc5YzVmMjIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTRUMTkzNzEwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MDM5OTgyNDQxMmJjMzlhZDNkMWJlZDhmNDQ5ZDNjNWY5YmU2YWZiZGI3MTkxMzcyNzBmNGU2MDViMzMwZmQzNyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.NTM5vaEPKve41QMqfqkA_kflwDKx7VSLM_pWZ8iGkuw)
Gazebo After (pay attention to logo on the bottle):
![WaterBottle_after](https://private-user-images.githubusercontent.com/4000684/275064774-10ea6788-1d40-49c3-ac2b-51279a80c0ab.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NjIxMzAsIm5iZiI6MTczOTU2MTgzMCwicGF0aCI6Ii80MDAwNjg0LzI3NTA2NDc3NC0xMGVhNjc4OC0xZDQwLTQ5YzMtYWMyYi01MTI3OWE4MGMwYWIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTRUMTkzNzEwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ODMzZDEyYWM4OWQ5MmYyZmZlODM1OWI3OTU2MGM4NzIxZTlmMDM0MjFjMmZjMmMxMTE3ODRmY2U3N2Y2MGJlMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.jTyD2zzwGrv5VIRm2Vikr4GjopK563m1b7YWitbk_VE)
three.js editor:
godot:
![WaterBottle_godot](https://private-user-images.githubusercontent.com/4000684/275111427-ef2cbc2d-626d-4229-b49b-8981e77ffba0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NjIxMzAsIm5iZiI6MTczOTU2MTgzMCwicGF0aCI6Ii80MDAwNjg0LzI3NTExMTQyNy1lZjJjYmMyZC02MjZkLTQyMjktYjQ5Yi04OTgxZTc3ZmZiYTAucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTRUMTkzNzEwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NmJkMTc1M2EzZjEyMjYyYjg4NDk2MzIzYjJlMDNhZjBhNmZiNTIxMDM1OGM3ODNkN2NmNDgyYjFkY2FiMjE3OCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.2p4ucK1Jb58jfOGghXFb7N9epoZ2-jwxq030KwllXyU)
BarramundiFish:
Gazebo Before:
![BarramundiFish_before](https://private-user-images.githubusercontent.com/4000684/275064797-b77a8bb4-59b1-49f7-981b-7de8f0c60cc1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NjIxMzAsIm5iZiI6MTczOTU2MTgzMCwicGF0aCI6Ii80MDAwNjg0LzI3NTA2NDc5Ny1iNzdhOGJiNC01OWIxLTQ5ZjctOTgxYi03ZGU4ZjBjNjBjYzEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTRUMTkzNzEwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MzJjNDE0MmEyOWIxNzAyZDBjMTE4ZDYwYTNjOWNhNmU2MGM0OTc2OWRhMTZjNTc3Mzc0Yjc1YzM4YWE3NzI2OSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ._1VLVr7H2Xd6pXwzQ5avFeVG3JqWgfu7xMHcLDl-1c0)
Gazebo After:
![BarramundiFish_after](https://private-user-images.githubusercontent.com/4000684/275064807-53e69def-c97a-475b-94f3-e13e673f67d4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NjIxMzAsIm5iZiI6MTczOTU2MTgzMCwicGF0aCI6Ii80MDAwNjg0LzI3NTA2NDgwNy01M2U2OWRlZi1jOTdhLTQ3NWItOTRmMy1lMTNlNjczZjY3ZDQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTRUMTkzNzEwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MWViNWE2YzVmNjdiNTMwMjgwNjgwZWQzMWIwOTc1NmNjMzdjMDQ4YmI4MzE2N2JkNGNmMGJkZTE2ZmNjZTNlNCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.6Xu6PzcJgyQngzFml4ZPpyWmJTHWrQ2rTJ-UUpCsGAM)
three.js editor:
![BarramundiFish_threejs_editor](https://private-user-images.githubusercontent.com/4000684/275111010-c53a6783-4f94-471b-bf44-d85ccc108ecf.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NjIxMzAsIm5iZiI6MTczOTU2MTgzMCwicGF0aCI6Ii80MDAwNjg0LzI3NTExMTAxMC1jNTNhNjc4My00Zjk0LTQ3MWItYmY0NC1kODVjY2MxMDhlY2YucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTRUMTkzNzEwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MTc3NmEzYjcxMzEwZTA2OGJkNzNmNmY2ZTI2NTk4MmZmZmY5OTIwMDZhM2MxMWQ3OGFkZjhlMjNmM2Q2MmRmYyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.a1AkiokOx6_TuO3TRuxYihWMrMvriPgXha4WfV9BGAA)
godot:
![BarramundiFish_godot](https://private-user-images.githubusercontent.com/4000684/275111147-6dcecab4-4caa-460a-9070-c7189895f2d0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NjIxMzAsIm5iZiI6MTczOTU2MTgzMCwicGF0aCI6Ii80MDAwNjg0LzI3NTExMTE0Ny02ZGNlY2FiNC00Y2FhLTQ2MGEtOTA3MC1jNzE4OTg5NWYyZDAucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTRUMTkzNzEwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MDIxZmZmZjVhNDEwYjEyMGJmMDkyMzE5Y2VjMGYwYjgxYjA2ZWFmNzNjYThlNjcxZTg0YTcwM2FjMTA3NDg0MCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.c_JFQhIrYnc51wpQOk4B0uck5L2bNlDUWO_6b8yaMnQ)
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.