HACD Problems (w/ pics)

User avatar
JohnHardy
Posts: 18
Joined: Mon Mar 05, 2012 11:39 pm
Location: Lancaster, UK

HACD Problems (w/ pics)

Post by JohnHardy »

Hey all,

Sorry to trouble you all with what is hopefully just me doing something silly. When I feed a trimesh into into Bullet's HACD processor (code below) I get the following meshes in and out.

Clearly, something is wrong, but I am not sure how to go about diagnosing the problem. I'm using Bullet via BulletSharp. Anyone seen anything like this?

1) A simple cube turns into a triangle. High Res: http://i.imgur.com/TInxf.png
Image

2) The classic table example. High Res: http://i.imgur.com/ld6Yv.png
Image

3) A more pronounced example. High Res: http://i.imgur.com/rTUgf.png
Image

Code: Select all

            // Create the HACD processor.
            var pProcessor = new Hacd();

            // Set the data.
            pProcessor.SetPoints(tVertices);
            pProcessor.SetTriangles(tIndices);

            // Other settings.
            pProcessor.CompacityWeight = 0.1;
            pProcessor.VolumeWeight = 0.0;
            pProcessor.NClusters = 2;

            pProcessor.VerticesPerConvexHull = 100;
            pProcessor.Concavity = 100;
            pProcessor.AddExtraDistPoints = false;
            pProcessor.AddFacesPoints = false;
            pProcessor.AddNeighboursDistPoints = false;

            // Compute the mesh.
            pProcessor.Compute();
            
            // Save the mesh.
            pProcessor.Save("/assets/myasset.wrl", false);
The variables tVertices and tIndices contain the vertex and index buffer respectively.

Any ideas? I'm at a loss!

Cheers,

John
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: HACD Problems (w/ pics)

Post by Flix »

Have you tried playing around with parameters ? Something like this:

Code: Select all

            pProcessor.NClusters = 20;
            pProcessor.Concavity = 10;
            pProcessor.AddExtraDistPoints = true;
            pProcessor.AddFacesPoints = true;
            pProcessor.AddNeighboursDistPoints = true;
User avatar
JohnHardy
Posts: 18
Joined: Mon Mar 05, 2012 11:39 pm
Location: Lancaster, UK

Re: HACD Problems (w/ pics)

Post by JohnHardy »

Heya - yea, I spent last night trying different combinations on different models. I'm guessing that my vertex / index format must be wrong somehow.

Are there any special conditions or formats to be aware of when using SetPoints and SetTriangles? It looks like its not getting all the faces right or something like that.

Here are those parameters: High Res: http://i.imgur.com/N7Ubg.png
Image
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: HACD Problems (w/ pics)

Post by Flix »

The mesh you're passing to HACD doesn't look correct indeed... maybe you're not passing it the right way...

If you can export the mesh in .obj or .off format and you're using windows, you can use the prebuilt converter I've made some time ago (here: http://bulletphysics.org/Bullet/phpBB3/ ... =17&t=7159), and play around with the configuration file to get the best decomposition parameters.