Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: HACD Problems (w/ pics)
PostPosted: Sat May 26, 2012 11:06 pm 
Offline

Joined: Mon Mar 05, 2012 11:39 pm
Posts: 9
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:
            // 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


Top
 Profile  
 
PostPosted: Sun May 27, 2012 7:04 am 
Offline

Joined: Tue Dec 25, 2007 1:06 pm
Posts: 315
Have you tried playing around with parameters ? Something like this:
Code:
            pProcessor.NClusters = 20;
            pProcessor.Concavity = 10;
            pProcessor.AddExtraDistPoints = true;
            pProcessor.AddFacesPoints = true;
            pProcessor.AddNeighboursDistPoints = true;


Top
 Profile  
 
PostPosted: Sun May 27, 2012 11:34 am 
Offline

Joined: Mon Mar 05, 2012 11:39 pm
Posts: 9
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


Top
 Profile  
 
PostPosted: Fri Jun 01, 2012 12:03 pm 
Offline

Joined: Tue Dec 25, 2007 1:06 pm
Posts: 315
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/viewtopic.php?f=17&t=7159), and play around with the configuration file to get the best decomposition parameters.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: Exabot [Bot], Google [Bot], STTrife and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group