Simplify btConvexHullShape?
-
- Posts: 31
- Joined: Sat Jul 23, 2011 4:24 pm
Simplify btConvexHullShape?
I have a point cloud with too many vertices and it's convex hull is too elaborate. I would like to simplify the convex shape that is generated by the constructor for btConvexHullShape but I have no idea how to do this?
-
- Posts: 25
- Joined: Thu Aug 11, 2011 6:42 pm
Re: Simplify btConvexHullShape?
use a simpler model?
EDIT:
if you can't do that, maybe weld vertices that are close together within a certain threshold?
EDIT:
if you can't do that, maybe weld vertices that are close together within a certain threshold?
-
- Posts: 28
- Joined: Sun Jul 31, 2011 11:20 pm
Re: Simplify btConvexHullShape?
I had this in my notes. I think it came from the Wiki. Haven't tried it yet but eventually I was going to need it. Maybe this is what you mean? I'm just parroting, interested to know if it works.
reduces the number of vertices to a minimum before using convexhullshape. Example is in bullet/demos/convexdecompositiondemo
reduces the number of vertices to a minimum before using convexhullshape. Example is in bullet/demos/convexdecompositiondemo
Code: Select all
// btConvexShape* originalConvexShape; is the original convexHullShape
//create a hull approximation
btShapeHull* hull = new btShapeHull(originalConvexShape);
btScalar margin = originalConvexShape->getMargin();
hull->buildHull(margin);
btConvexHullShape* simplifiedConvexShape = new btConvexHullShape(hull->getVertexPointer(),hull->numVertices());
-
- Posts: 237
- Joined: Tue Jun 29, 2010 10:27 pm
Re: Simplify btConvexHullShape?
Yes the btShapeHull is one way to go. It simplifies a convex hull using a 42-point sphere, resulting in a convex hull of 42 points, or sometimes less (based on my own experimentation). I looked into this when checking out the new HACD decomposition library in Bullet, to simplify produced convex hulls. However, after experimenting, it seemed to me that the HACD library's own hull simplification tools did a better job of hull conservation vs num vertices trade-off. But in general, btShapeHull should be decent.
-
- Posts: 31
- Joined: Sat Jul 23, 2011 4:24 pm
Re: Simplify btConvexHullShape?
This idea does appear to have worked!eagletree wrote:I had this in my notes. I think it came from the Wiki. Haven't tried it yet but eventually I was going to need it. Maybe this is what you mean? I'm just parroting, interested to know if it works.
reduces the number of vertices to a minimum before using convexhullshape. Example is in bullet/demos/convexdecompositiondemo
Code: Select all
// btConvexShape* originalConvexShape; is the original convexHullShape //create a hull approximation btShapeHull* hull = new btShapeHull(originalConvexShape); btScalar margin = originalConvexShape->getMargin(); hull->buildHull(margin); btConvexHullShape* simplifiedConvexShape = new btConvexHullShape(hull->getVertexPointer(),hull->numVertices());
Last edited by SteveDeFacto on Thu Sep 01, 2011 3:55 pm, edited 1 time in total.
-
- Posts: 456
- Joined: Tue Dec 25, 2007 1:06 pm
Re: Simplify btConvexHullShape?
Good to know. Now I understand what dphil meant in another post .eagletree wrote:[btShapeHull] reduces the number of vertices to a minimum before using convexhullshape. Example is in bullet/demos/convexdecompositiondemo
I've added this feature to my HACD demo here http://bulletphysics.org/Bullet/phpBB3/ ... =17&t=7159, although I agree that HACD itself does a better job in most cases in reducing the number of hull vertices.
-
- Posts: 31
- Joined: Sat Jul 23, 2011 4:24 pm
Re: Simplify btConvexHullShape?
Yeah, I ended up reverting back to my engine's reduction algorithm. It's just not quite good enough for my uses.Flix wrote:Good to know. Now I understand what dphil meant in another post .eagletree wrote:[btShapeHull] reduces the number of vertices to a minimum before using convexhullshape. Example is in bullet/demos/convexdecompositiondemo
I've added this feature to my HACD demo here http://bulletphysics.org/Bullet/phpBB3/ ... =17&t=7159, although I agree that HACD itself does a better job in most cases in reducing the number of hull vertices.