Skip to content

Using assimp to load objects#30

Open
antoninklopp wants to merge 1 commit intogaschler:masterfrom
antoninklopp:load-with-assimp
Open

Using assimp to load objects#30
antoninklopp wants to merge 1 commit intogaschler:masterfrom
antoninklopp:load-with-assimp

Conversation

@antoninklopp
Copy link
Copy Markdown

Hi,

Thanks for this amazing project, which is working really great.

However, there are a lot of file types not supported and even for file types supported, some are not loading as expected. I think that you could benefit from using a library like assimp to load your objects.
It simplifies the code and allows a better loading.

I did it with a simple car :

With your loading
loading-before

With assimp loading
loading-after

Some artefacts remain on the car dur to the fact that the obj file defines several parts and your object is a single array

It comes from the fact that some .obj files can have 4 vertices coordinates and you are only reading 3 for example, and the result is that you are missing one triangle over two.

It is also possible to load files like .glb, this one is working great for example avocado. However some are not working (buggy) because of asserts in the addTriangle method.

Hope this helps !
Thanks again for this amazing project.

@gaschler gaschler self-requested a review November 9, 2019 05:19
Copy link
Copy Markdown
Owner

@gaschler gaschler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution.
I also think reusing a mesh import lib is a good choice here and makes things simpler.

I added a couple of comments to the code, please resolve.
Feel free to ask if any comment doesn't make sense.

Just a hint for the future, before you write such large patch, feel free to ask
if the feature is needed, not all pull requests will be merged, especially the kind of patches that add dependencies.

Thanks again, looking forward to seeing this merged

Comment thread src/boundingmesh/Mesh.h Outdated
Comment thread src/boundingmesh-gui/gui.cpp Outdated
Comment thread src/boundingmesh-bin/boundingmesh-cli.cpp Outdated
Comment thread src/boundingmesh/CMakeLists.txt Outdated
Comment thread src/boundingmesh/CMakeLists.txt Outdated
Comment thread src/boundingmesh/Mesh.cpp Outdated
return;
for (int meshIndex = 0; meshIndex < scene->mNumMeshes; meshIndex ++ ){
const aiMesh* myMesh = scene->mMeshes[meshIndex];
for (int i = 0; i < myMesh->mNumVertices; i++){
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, for (const auto& vertex : mesh->mVertices)
also below for the faces

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Comment thread src/boundingmesh/Mesh.cpp Outdated
Comment thread src/boundingmesh/Mesh.cpp Outdated
// And have it read the given file with some example postprocessing
// Usually - if speed is not the most important aspect for you - you'll
// propably to request more postprocessing than we do in this example.
const aiScene* scene = importer.ReadFile( pFile,
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is quite a change.
Please confirm you are actually planning fix bugs if this introduces any.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will

@@ -4,9 +4,16 @@ find_package(Eigen 3 REQUIRED)
find_package(Coin)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this a quite a change, run all tests with docker.
Please install docker and follow the command documented in https://github.com/gaschler/bounding-mesh#contribute

find_package(Coin)
find_package(CGAL)
find_package(GMP)
find_package(assimp)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if boundingmesh is used with Windows by anyone.
How likely will Windows users be able to get this compiled with this new dependency?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally assimp should work fine with windows

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I don't really know for the installation part

@gaschler
Copy link
Copy Markdown
Owner

gaschler commented Dec 8, 2019

Feel free to ask if there are any questions how to get this fixed and merged.
I agree that moving to assimp is a good idea.

@antoninklopp
Copy link
Copy Markdown
Author

I did not have much time lately, I plan to fix everything this week !

@antoninklopp
Copy link
Copy Markdown
Author

I still need to fix the docker build with ninja not finding assimp at step 7.
I think that I resolved some of your comments and left comments to others 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants