Approximate Convex Decomposition

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Re: Approximate Convex Decomposition

Postby khaled » Mon Nov 12, 2012 11:35 pm

Dear all,

A new approximate convex decomposition library is available here V-HACD library http://code.google.com/p/v-hacd/

For more details
http://kmamou.blogspot.ca/2012/11/v-hacd-hierarchical-approximate-convex.html
http://kmamou.blogspot.ca/2012/11/v-hacd-replacing-triangle-s-constrained.html

I am still working on finalizing the algorithm and cleaning/optimizing the code.

Enjoy!

P.S.: do not hesitate to report bugs :)!
khaled
 
Posts: 19
Joined: Sat May 07, 2011 8:57 am

Re: Approximate Convex Decomposition

Postby carli2 » Tue Nov 13, 2012 3:32 am

The makefile in src/ seems to not correctly handle paths

Code: Select all
v-hacd/src$ make
Scanning dependencies of target VHACD_LIB
[ 11%] Building CXX object VHACD_Lib/CMakeFiles/VHACD_LIB.dir/src/vhacdHACD.cpp.o
/home/carli/sources/v-hacd/src/VHACD_Lib/src/vhacdHACD.cpp:17:24: fatal error: VHACDGraph.h: No such file or directory
compilation terminated.
carli2
 
Posts: 157
Joined: Thu Nov 10, 2011 1:53 pm

Re: Approximate Convex Decomposition

Postby AntonSynytsia » Sun Jun 08, 2014 8:36 pm

khaled wrote:A new approximate convex decomposition library is available here V-HACD library http://code.google.com/p/v-hacd/

This looks amazing! Juleo, did you implement this into Newton? If not, I will implement this into my wrapper.
AntonSynytsia
 
Posts: 193
Joined: Sat Dec 28, 2013 6:36 pm

Re: Approximate Convex Decomposition

Postby Julio Jerez » Mon Jun 09, 2014 7:05 am

newton had approximate convex decomposition for a long time ago. about five year now. look at the demos there are some examples.

what was added to the library is already in newton long time ago. Newton only use constrained delanai triangulation meshes, that's no a feature at least no in newton.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Approximate Convex Decomposition

Postby pHySiQuE » Fri Jun 20, 2014 2:57 pm

My advice after working with convex decomposition for a while is don't even bother with this stuff.
1. Visual geometry is almost always vastly different from physics geometry, and converting it into physics geometry produces awful inefficient results.
2. After that I thought we would just model the physics geometry with arbitrary polygons, and run it through a convex decomposition step to break it into pieces. The routine was still glitchy and needed lots of manual adjustment, so at that point my workflow had the worst of both worlds: physics geometry still had to be hand-modeled, but it required a lot of adjustment to get a good decomposition result!

So now we just model our physics shapes out of convex objects. I name the objects "collisionhull" and then our model loader just turns that into a compound physics shape. It's far easier this way.
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Approximate Convex Decomposition

Postby Julio Jerez » Sat Jun 21, 2014 11:00 am

yes it required some tweak, but for that you need to supply a graphics using interface.

take a look at this tool: http://www.ultimategametools.com/produc ... lider/help
It use newton's implementation.
also if you use Max12 and max13 they use the Newton Tool as well, The Newton tool was separated as a stand alone tool by John Ratclift from nvidea.
so you are right, in the sense the the tool is no perfect, but I say it is a great deal of help when used in a tool pipeline for production.
It save a lot of time, and in many case rival a hand modeled shape.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Approximate Convex Decomposition

Postby khaled » Thu Nov 20, 2014 2:15 pm

V-HACD V2.0 is here and it kicks ass. Check it out!
http://kmamou.blogspot.ca/2014/11/v-hacd-v20-is-here.html
khaled
 
Posts: 19
Joined: Sat May 07, 2011 8:57 am

Re: Approximate Convex Decomposition

Postby manny » Thu Nov 20, 2014 3:50 pm

That looks really nice, great job on the improvement.
http://www.instaLOD.io - InstaLOD - State of the art 3D optimization
manny
Site Admin
Site Admin
 
Posts: 131
Joined: Tue Feb 11, 2014 6:49 pm

Re: Approximate Convex Decomposition

Postby AntonSynytsia » Thu Nov 20, 2014 5:38 pm

Wow, great work! Would be nice if Juleo implementes this, V-HACD2, into his physics engine!
AntonSynytsia
 
Posts: 193
Joined: Sat Dec 28, 2013 6:36 pm

Re: Approximate Convex Decomposition

Postby Julio Jerez » Fri Nov 21, 2014 12:28 am

Newton has convex decomposition. it also have coronoid debrief,
you can try in the sandbox demos.

actually the quality of the Newton decomposition is similar to the Hath two without clipping the mesh.
The mesh clipping, in my option is not a good idea. The reason is that the number of segment you get if a function of the volume of your mesh.

I am quite satisfied with the implementation In newton which uses a revised version of khaled concavity metric, which I believe has a flaw in the assumption of monotonicity.
try the demos in newton so that you can see.

Plus there is nothing that prevent a end user from integrating any third party library with the engine.
The engine provides a generic Mesh Interface to connect with external tools. NewtonMesh.

All you need to do is make the convex decomposition, and the turn each convex piece into a
NewtonMesh, or a newton Mesh segment and then create the compound collision passing the mesh and input.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Approximate Convex Decomposition

Postby khaled » Fri Nov 21, 2014 3:31 am

Hi Julio,
Please, is John's version of your convex decomposition up-to-date (https://code.google.com/p/hacd/)?
What parameters do you suggest for the following models (included in John's version)?

beshon.obj
box-thick.obj
bunny.obj
character.obj
ConvexDecomposition.obj
cylinder.obj
deer_bound.obj
hornbug.obj
horse_walk.obj
hose.obj
ob_chair_gothic.obj
ob_chair_wood.obj
ob_chess_table.obj
sphere.obj
torus1.obj
torus2.obj
khaled
 
Posts: 19
Joined: Sat May 07, 2011 8:57 am

Re: Approximate Convex Decomposition

Postby Julio Jerez » Fri Nov 21, 2014 11:49 am

Johns version in not up today, I added some refinement but I do not think he ever incorporate them.
I can check then out this weekend.

In the Newton SDK, I imported some model, (the Cow, the Camel, the chair, the Bug)
the cow and Camel is implied, because the are too large for download.

This simplification is not a cheat, it is done with the same functionality of the Mesh Toll, it is just that those file alone are larger that all the assert in the demos.
I also have the hollow box and hollow Bessel.

anyway if you download the Newton SDK library form GitHub, and you select the simple convex decomposition demo, you can select the option show wire collision frame or show solid collision
and it will show how the look.

As I was explaining to you over the Jon Radcliff blog
http://codesuppository.blogspot.com/2011/12/new-implementation-of-hacd-algorithm.html

The problem I found with your concavity metric is that you assume hat that the concavity of a two buddle of face and edge selection form the selection on one split, is always lower that the concavity of the original bundle.
So you original algorithm assume the split with the lower concavity and keep doing recursively.

this is not so, it is possible to have a collision of face and each split will increase concavity, this is obvious for a set that is already convex it is also true for sets that are not convex as well.

so my adaptation Is that I do no generate a single set of splits, I generate a hierarch of splits,
the on a second pass using annealining, I walk the trees calculation the concavity of the children's. and the grand children.
and each time the grand children produce a value that with concavity close to the grand parent is recursively fuses then children and continue doing it until no more reduction can be made.
This create a hierarchical that is very much parameter less.

basically you can have select any degree co convexity you want.

for example a very dense sphere, will generate a parent that is the convex of the sphere at the top, and lot of children annealinig process delete all the children that do not increase concavity, leaning only the root.

if for example you take the sphere an add a notch, it will generate the top sphere and some splits, as children, of the desired level is reach.
All the sample in the Newton demos use that technique, and I get good results.

I am no sure if Ratclift ever added that last fixes a added.
Last time I was in contact wih him he set so that I have tow mode, the one that find the first series of decomposition and optimally the second pass, the second pass take longer and he was satisfied with the first result.

anyway I see if I can test some of those sample meshes. they seem simple enough to me, because they are all well form meshed. the mesh that present that biggest problem are the mesh with mal form topologies.

an example of that is the Cessna airplane. This is use in the OpenScen Grapfh library, and weh I try to decomposed, it expose some weakness of the algorithm and I added some fix to account for those cases.

I have no doubt that there may be still many flaws, and may fail spectacularly on some meshes, but
to me after years of Newton, I found out that people adding functionality to the library is a waste of my time.

It is more important to have good advertising and mediocre support that good support and no advertising at all.

I added many advance feature to the library, but they state dormant for years, until some one announce the same thing somewhere else, than people take a look.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Approximate Convex Decomposition

Postby Julio Jerez » Fri Nov 21, 2014 12:17 pm

By looking at the images, There is one thing, that I can see is a big win on you new version.
that is that cutting the mesh generated non overlapping convex. and that could be a good thing.
what I do not looked is the regular cuts.

I have being think about that for some time, and my approach's was something along the line of
create a set of convex, then reconstruct an proximate mesh that extract the overlapping volumes.

and the decomposes aging this time using Voronoid decomposition.

I have the first and second part, but I never completed the Boolean operators for the NewtonMesh so that I can reconstruct the mesh after the fist decomposition.

In theory this algorithm will lead to a perfect non overlapping decomposition, depend on how good the first decomposition is.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Approximate Convex Decomposition

Postby khaled » Fri Nov 21, 2014 12:50 pm

Thanks for the explanation. It would be great if you would make John's version up-to-date or maybe publish a standalone version that doesn't have dependencies on Newton SDK.

Regarding the fact that the HACD's energy function used to choose to merge faces is not monotone, I agree. In fact, the concavity portion is monotone. The portion related to the aspect ratio is not. This later term was added to avoid generating elongated patches...

Anyway, the new version has a totally different concavity measure. Please, give it a try and let me know what you think.
khaled
 
Posts: 19
Joined: Sat May 07, 2011 8:57 am

Re: Approximate Convex Decomposition

Postby Bird » Mon Nov 24, 2014 10:43 am

Hi Khaled,

The new version looks great! Thanks

I hooked it up to my project and did some quick side by side comparisons with Julio's version. I passed the meshes through a polygon reduction(about 90%) tool before decomposing

Newton version on the right.
http://hurleyworks.com/media/flash/ConvexDecompTest/ConvexDecompTest.html

I used these settings for HACD

resolution = 100000;
depth = 20;
concavity = 0.0025;
planeDownsampling = 4;
convexhullDownsampling = 4;
alpha = 0.05;
beta = 0.05;
pca = 1;
mode = 0;

and for Newton
NewtonMeshApproximateConvexDecomposition (mesh, 0.01f, 0.2f, 256, 100, nullptr, nullptr);

With these settings Newton was much faster at decomposing the mesh. You can get an idea of the relative speeds during the decomp of the army man at the end. As you can see both Newton and HACD had problems with that model;

-Bird
Bird
 
Posts: 623
Joined: Tue Nov 22, 2011 1:27 am

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 57 guests