SarahWeiii / CoACD

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

any tips for making the library run faster? #47

Open eilat-inbal opened 4 months ago

eilat-inbal commented 4 months ago

Hi, Thanks for this awesome library! I'm getting great results but the computation time is very long... Any tips on how to make it run faster? I'm running on windows, c++ like this:

coacd::Params params; params.preprocess_mode = "on"; params.prep_resolution = 150; params.pca = false; params.mcts_max_depth = 2; params.mcts_iteration = 60; params.merge = true; params.threshold = 0.02; coacd::Model convexMesh; convexMesh.Load(vertices, indices); convexParts = coacd::Compute(convexMesh, params);

for my mesh, with these parameters t took a few minutes! I tried making the threshold bigger and the prep_resolution smaller. and that helps but the computation is still very long, and the results are not as good... any further options for multithreading? for GPU?

image

thanks! Inbal

SarahWeiii commented 4 months ago

Hi, the code supports using OpenMP for parallel computing, have you already enabled that?

kermado commented 2 months ago

I was able to make the library quite a bit faster (at least 3X) by performing some simple optimizations. The main changes, IIRC, were:

Also, since the library allocates quite a lot of memory, it may be worth using a different memory allocator if building with multithreading. I found Mimalloc to give good results.