kmammou / v-hacd

Automatically exported from code.google.com/p/v-hacd

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

V4.1 Always producing m_maxConvexHulls

neemoh opened this issue · comments

First of all, thanks a lot for updating this very useful library. The usability has improved a lot :)

I just made a comparison between version 2.3 that I have been using, and 4.1. It seems to me that in the new version we always get a number of convex hulls that is the same as m_maxConvexHulls. That is in 2.3 if I set m_maxConvexHulls = 20, I will get a number of convex hulls up to 20, but in 4.1 I always get 20. As it stands it is almost impossible to provide some predefined approximation levels, because for each geometry one has to now play around with m_maxConvexHulls to find a reasonable number for each specific geometry.

Here is an example:

image

Here are the parameters for each level:

if (quality ==VHACDQUALITY::ULTRA)
{
    params.m_resolution     = 2000000;
    params.m_maxConvexHulls = 100;
}
else if (quality ==VHACDQUALITY::HIGH)
{
    params.m_resolution     = 100000;
    params.m_maxConvexHulls = 20;
}
else if (quality ==VHACDQUALITY::MEDIUM)
{
    params.m_resolution     = 50000;
    params.m_maxConvexHulls = 5;
}
else if (quality ==VHACDQUALITY::LOW)
{
    params.m_resolution     = 40000;
    params.m_maxConvexHulls = 2;
}
else
{
    params.m_resolution     = 500;
    params.m_maxConvexHulls = 1;
}

Yeah, I think that is probably an accurate observation. I am currently traveling and won't have access to my computer for a couple of weeks before I can look into it further. There is a volume conservation parameter which might make it behave more like you are expecting.

If you change "m_minimumVolumePercentErrorAllowed" to say 5 (for five percent volume error allowed, it might change the behavior. Try a few different values and let me know if that gets you anywhere.

Hi John, Thanks for the hint. I appreciate the quick response.

Only at m_minimumVolumePercentErrorAllowed=50 I started to see a drop in the number of convex hulls but then the decomposition was a bit poor with such high error.

image

Just heard from a colleague of mine that they have played around with the parameters trying to get similar behavior to what we got from V2.3 (in terms of num convex hulls) but they had no success.

Yeah. Sorry about that. The previous version used an angle error metric which would sometimes completely fail. When I rewrote it I focused on volume conservation to fix that bug. Also, to be honest, in all of my personal use cases I want to specify the number of output convex hulls so I wasn't really focusing on this problem. There is a new convex decomposition library out now that produces better results than mine.

Here is the link: https://colin97.github.io/CoACD/

I am retired now and I don't know if I'm going to be doing much to this library anymore. Apparently I'm now a grandpa and a farmer in Hawaii, so coding has become pretty low priority to me.

Since this CoACD does work better than VHACD I think it's worth transitioning to it.

Hi John, sorry I missed your last comment somehow. Thanks a bunch for the info and no worries at all! I have also come to the conclusion that instead of providing predefined levels, having the number of convex hulls as the parameter to play with is a better idea.

About COACD, I had actually looked into that too. An issue with their method is that the convex hulls have a large number of vertices (which slows down collision checking) and unlike VHACD there is no parameter to set a ceiling on it. I have brought this to their attention. The compute time is also huge, compared to VHACD. So, for the time being VHACD is my choice :)

Anyways, I will close this issue now. Thanks for the help and enjoy your retirement in Hawaii!!!
image