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

Reduce number of vertices in each convex hull #37

Closed neemoh closed 4 months ago

neemoh commented 1 year ago

I was wondering if there is a way to reduce the number of vertices of each convex hull.

Compared to VHACD I get a lot more vertices per convex hull with COACD. Although I am quite impressed with the quality of the decomposition of COACD, the high number of vertices will affect collision checking too just like having too many convex hulls.

Here is an example. Compare for instance the VHACD2 MEDIUM case that has 8 convex hulls with 369 vertices and the COACD LOW case that has a similar 7 convex hulls but with 10 times more vertices:

image

SarahWeiii commented 1 year ago

Thanks for bringing up the issue! I'll look into improving it when I have a moment to spare.

SarahWeiii commented 1 year ago

btw you can turn off the pre-processing if your input is manifold if it is not, one quick way to fix the problem is to manually remesh + simplify the input

neemoh commented 1 year ago

Thanks for the hint Sarah. Taking some time off now, and will check when back in the office in a couple of weeks. Will the pre processing affect the number of output vertices?

Unfortunately, manual re meshing of the input won't be a great option, because we need something that works with little intervention from users. The VHACD has a parameter to specify the maximum number of vertices per convex hull (we use the default 64). Would such a parameter be feasible to have in COACD?

SarahWeiii commented 11 months ago

oh sorry for the late reply. The results are convex hulls of the original mesh so the pre-processing can reduce the output vertices. I planned to add some automatic pre-processing but haven't finished. It can help reduce the vertices but cannot specify the maximum number of vertices per convex hull.

neemoh commented 10 months ago

That is great to hear! I think one can live without specifying the exact number of vertices. However, being able to reduce the number of vertices is really crucial to speed up collision-checking, which is a common use of composite convex hulls.

MagixGames commented 4 months ago

Many months later but I too would love to see this feature realized. I've been trying to use this tool for Unity collision and another proprietary collision engine, but both require no more than 256 vertices and sometimes meshes with more than that are output.

SarahWeiii commented 4 months ago

Hi the feature is added; use -d to enable convex hull max vertex contraint and -dt to set the max value.