Nice work, Khaled!
I've just made a pair of experiments (on the "Bullet bunny" mesh) and the results look good.
I guess that vHACD could be used mainly when we want to separate parts of the original shape (maybe together with RBD's convex shatter algorithm to produce a bigger number of debris).
Or do you think that for generic convex decomposition it's better than the "original" HACD?
PS. in "hacdHACD.h" and "vhacdHACD.h":
#include <functional> is needed in VC++2012 for std::greater (VC++2010 was OK without it).
PS2. I'm almost sure that some time ago I managed to get a good decomposition of RBD's fork mesh with (a version of) the original HACD. However I didn't save it (or its decomposition parameters). RBD's post was written in April, but if he still needs it, I can try and see if I can do it again...
[Edit] Just tried the new vHACD with the fork mesh:
Attachment:
fork1_vHACD.JPG [ 39.85 KiB | Viewed 655 times ]
This one was made with these params:
Code:
depth(10), //depth: maximum number of decomposition stages (type: integer, default: 10)
maxConcavity(0.01f), //maxConcavity: maximum allowed concavity (type: float, default 0.01)
invertInputFaces(false), //indicates whether mesh normals should be inverted or not (type: boolean, default 0)
posSampling(10), //posSampling: clipping plane position sampling resolution for coarse search (type: int, default 10)
angleSampling(10), //angleSampling: clipping plane orientation sampling resolution for coarse search (type: int, default 10)
posRefine(5), //posRefine: clipping plane position sampling resolution for refined search (type: int, default 5)
angleRefine(5), //angleRefine: clipping plane orientation sampling resolution for refined search (type: int, default 5)
alpha(0.01), //alpha: parameter controlling the compromise between concavity and balance between convex-hulls. (type: float, default: 0.01)
targetNTrianglesDecimatedMesh( 0)
A simpler version (10 clusters) here:
Attachment:
fork_simpler_vHACD.JPG [ 41.99 KiB | Viewed 655 times ]
was made with these params:
Code:
targetNTrianglesDecimatedMesh = 500;
depth = 5; //depth: maximum number of decomposition stages (type: integer, default: 10)
maxConcavity =0.04f; //maxConcavity: maximum allowed concavity (type: float, default 0.01)
invertInputFaces = false; //indicates whether mesh normals should be inverted or not (type: boolean, default 0)
posSampling = 5; //posSampling: clipping plane position sampling resolution for coarse search (type: int, default 10)
angleSampling = 5; //angleSampling: clipping plane orientation sampling resolution for coarse search (type: int, default 10)
posRefine = 3; //posRefine: clipping plane position sampling resolution for refined search (type: int, default 5)
angleRefine = 3; //angleRefine: clipping plane orientation sampling resolution for refined search (type: int, default 5)
alpha = 0.04; //alpha: parameter controlling the compromise between concavity and balance between convex-hulls. (type: float, default: 0.01)