-
Notifications
You must be signed in to change notification settings - Fork 39
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
Analysis of external mesh loading libraries and comparison with the existing approach #344
Comments
Thank you for the ticket and for looking into it, @onurtore . It would be great to add this capability to Gazebo. Looking forward to seeing the results of your analysis. |
small update: Very basic transformation algorithm written (Just considers, vertices,indices and normals like the STLLoader.), now going to integrate Assimp to Gazebo to create speed and size metrics. If possible I will write this as plugin. |
Hi! I thought it would be interesting to try out assimp and am in the process of writing an assimp loader class following the collada / obj / stl loader classes to load assets through assimp.
For now I'll be focusing on parsing obj, dae and glb since those are the formats I personally use the most, I'll also try to unify all the unit tests in the collada / stl / obj loader into a single unit test file for assimp to try keep coverage high. |
I ran into a critical issue with the assimp library included in Ubuntu 20.04 (v5.0.1) that is unable to parse DAE assets with empty tags (i.e. empty |
@luca-della-vedova Thanks. |
@luca-della-vedova |
The main change I had to deal with is that assets with empty author tags, there is a lot of them in the Ignition Edifice world, for example if you try to run:
With a 20.04 binary it will fail and crash since the empty tag XML, for example in the Crates.dae file, will make assimp fail to import the asset. If you build assimp from source on latest master it's better.
You should see a segmentation fault, still looking into it. |
@luca-della-vedova,
Only once I got error saing there is a assertion problem where the parameter of the argument of the loadDynamicImage function should be 6u. Other than that its runs. actor.sdf doesnt work, but it is too complex to handle the whole world, so I started with a simpler version: MecanumLift.dae. I will work on that as next step. Update: Looks like our skeleton loading code has problems. This will be a good oppurtunity to implement basic fallback system to default loaders as mentioned here. Update (27/05/22): Additional Problems: Removing all the skeleton loading code still does not gives a visually correct output. That means recursiveCreate function has also problems. First I will fix the recursiveCreate function and then move on the Skeleton codes. Update(28/05/22): |
Strange, but now I don't have a clean machine to test with binary 5.0.1 anymore! 😅
Yea it's a bit tricky because one actor with one animation works, seems to be an issue with either multiple animations or one of the ones I didn't manage to test yet.
Yea I saw the biggest issue right now is something about duplicated bone names, I'm sure it can be fixed at the Update from my side, I'm currently looking at PBR materials and embedded textures. PBR materials are reasonably simple to implement but a lot of interesting formats (i.e. fbx, glb) create a single binary blob with the mesh and all its related textures. gz-common does not currently support setting data structures (i.e. an array of bytes) as textures but only filenames so the change might be a bit more involved and span multiple packages. |
Good news! There is pretty much feature parity in the demo worlds between the assimp loader and our custom STL / OBJ / DAE loaders! Edifice demo where every asset is loaded through assimp below: @onurtore I can't see any issue with the mecanum lift, you can try the latest changes with assimp built from source and see how that goes? The main issue right now is only in actor.sdf that might require some work here and there, for example it seems gz-sim expects the first animation to actually only be the skin and I don't think the loader is doing that right now. I'll start looking at more niche features but this might soon be reaching a "good enough for basic operations" stage, as long as we are conservative with the custom loader behavior (for now there has been no issue with STL and OBJ but collada still has a few rough edges) and find a way to add the dependency for binary assimp. Some example of more niche features that are still TODO:
|
Hi @luca-della-vedova, In order to progress, I used the source installation of 5.1.1. I test some of the worlds, while MaceneumLift.dae works in empty world, it does not work when I try to add it to eddifice. Meshes without normals still have problems, maybe this will help. |
For the error personally I just deleted the line with the issue and it seems to work |
@luca-della-vedova thanks for the heads up. Update: Removing whole interpolation code loads the actor.sdf into Gazebo. Unfortunately, loaded meshes have weird arms and playing the animations ends up with a segmentation fault after a while. Fixing the weird arm problem looks easier and I am working on that. |
Sounds good! One of the issues I can see from the screenshot is that the actors are also upside down, I guess both the upside down issue and the weird arms are issues with the node transforms and might have the same (or a similar) solution? In the meanwhile I'm getting to work with embedded textures so there might be some pretty consistent changes in the branch to allow reading binary textures |
Small update: Assimp can not parse all the inverse bind transform. This happens because skeleton creation uses nodes, but code sets the inverse bind transform using mesh' bones. If number of bones and the number of nodes are not 1-1 correspondence then this creates nodes without inverse transform. Assimp sometimes does not include bones to hierarchy and I am trying to fix that or find a way to remove nodes without bones or automatically find the transformation of nodes without bones. |
Thanks for digging into this! I noticed that this was documented in |
Hi @luca-della-vedova,
We can move with option three or four depending on what type of solution we are looking for. I implemented the fourth in here, if you can test it it will be appreciated. I am planning to create a PR in assimp for this. (This branch might still create a seg fault, due to animations and below should be setted in Gazebo:
|
Thanks for the great work! I agree solution 3 and 4 look like the best fits. I am quite neutral to which way to go for, I had a look at your branch and it seems n.4 is quite simple even at the assimp level however if it cannot fix the inverted skeleton it's maybe not super ideal.
However I see the same segfaults, am I missing anything? |
Hi @luca, |
Hi @luca-della-vedova, Second, |
Desired behavior
Be able to load glTF2 and FBX mesh files into Gazebo.
Alternatives considered
Only alternative is on the user side, which creates additional step for converting mesh files into Ignition Gazebo readable format.
Implementation suggestion
There are two ways to extend the capabilities of the Gazebo's mesh loading system; (A) Using an external open-source library or (B) Writing glTF2 and FBX mesh loaders in a consistent way with the current approach.
Analysis is required to decide which approach is better. I am planning to generate such analysis in the next couple of days, so any idea is welcome. Currently gathering ideas around the internet to make a suitable comparision.
I created an additional document for this analysis in here. I will start my analysis with assimp.
Additional context
The text was updated successfully, but these errors were encountered: