SarahWeiii / CoACD

[SIGGRAPH2022] Approximate Convex Decomposition for 3D Meshes with Collision-Aware Concavity and Tree Search
https://colin97.github.io/CoACD/
MIT License
405 stars 52 forks source link

Slimmer C++ dependencies? #41

Closed yuvaltassa closed 2 months ago

yuvaltassa commented 5 months ago

Hi CoACD!

Yuval here from the MuJoCo dev team. Like many others, we are really impressed by CoACD outputs and are enthusiastically recommending it to our users at every opportunity.

We were delighted to discover that you now have a C++ API. Including optional automatic CoACD pre-processing would really improve our user's lives. However, we then saw that your dependencies include extremely large packages like openvdb and boost. We work very hard to keep MuJoCo's dependencies to the absolute minimum, and indeed all of our dependencies are very small and have no dependencies themselves.

Do you have any plans to reduce your dependency payload?

If yes, please let us know. We would love to help spread your excellent algorithms to the physics-simulating, open-source world 🙂 🌍

SarahWeiii commented 5 months ago

Hi, thank you so much for your interest in our library! I'm glad to hear that you would like to include CoACD in MuJoCo. Currently, almost all large packages are for preprocessing meshes in the wild into 2-manifold ones. OpenVDB offers a good remeshing algorithm though it indeed has a lot of dependencies. If you have suggestions for a remeshing library with fewer dependencies, I believe I could replace the current one with it, significantly reducing the dependencies.

yuvaltassa commented 5 months ago

Could you define "remeshing" more precisely? I'm guessing you need watertightness? Or do you also need resolution {up/down}-scaling?

Here's a proposal for you, which works well especially if you use the remeshing functionality as-is, without exposing knobs to the user. Testing for watertightness (as opposed to remeshing) is really easy (I can show you how, if you like). Perhaps you could add an option to build CoACD without these dependencies at all (exposed to cmake), in which case it throws an error like "Mesh %s is not watertight. Please fix your mesh or rebuild CoACD with {autoremeshoption}".

I think this addresses everybody's requirements? I think this is also better practice for a C++ library.

While we're on the subject, can I ask if the eigen dependency could be dropped as well? I'm guessing this might be harder, and eigen is certainly not as bad as OpenVDB, but worth asking 🙂

SSNTails commented 3 months ago

This is a great idea - for example, V-HACD is just a single .h file to include. Eliminating heavy dependencies would increase adoption of this library.

SarahWeiii commented 3 months ago

Hi I have added an option to disable 3rd party libraries, you can use it by adding -DWITH_3RD_PARTY_LIBS=OFF to cmake options. The code will exit when encountering a non-manifold input.

LinDadaism commented 3 months ago

@SarahWeiii Thanks for adding the disable option! A follow-up request is that now the tarball or zip in the released tag is no longer the most updated with this change, meaning I have to point to the latest commit when using FetchContent_Declare in cmake.

I'm guessing this is not so big of a change worth releasing another version (but maybe a minor bump?) Is there a way that I can avoid pulling down the entire source repo but still using the 3rd party disable option with cmake?

SarahWeiii commented 3 months ago

Added a new release

yuvaltassa commented 2 months ago

Update from us, we now have an internal draft of MuJoCo-CoAcd integration, hopefully this actually happen soon 🙂

I'll open a new issue if there are any problems.

PS Is it CoAcd or CoACD?

SarahWeiii commented 2 months ago

Thank you for the update! I'm eagerly awaiting the release of the final version. 😊 It is CoACD.