Convex Decomposition without wavefront?

Karrok
Posts: 65
Joined: Fri May 13, 2011 1:11 pm

Convex Decomposition without wavefront?

Post by Karrok »

Hey all,

I was wondering how I can perform convex decomposition on Bullet shapes.

The demo is largely focused on wavefront stuff.
It would be better to have the demo abstract away from that, and just use a bullet shape as starting point (and let the user decide how it gets the initial bullet shape).

So, lets say I have a concave trimesh (btBvhTriangleMeshShape), in my case from a source .osg file), how do I perform the concave decomposition?

ie, btCompoundShape * somecompoundshape = performDecomposition(concave_trimesh);
or somesuch would be awesome.

Cheers
Karrok
Posts: 65
Joined: Fri May 13, 2011 1:11 pm

Re: Convex Decomposition without wavefront?

Post by Karrok »

Guess its a great mystery? :)
User avatar
jarno
Posts: 57
Joined: Tue Mar 16, 2010 1:42 am

Re: Convex Decomposition without wavefront?

Post by jarno »

Fill in a ConvexDecomposition::DecompDesc structure, create a ConvexBuilder, call the process method of the convex builder with the decompdesc structure.
You'll also have to create a ConvexDecompInterface subclass to implement the ConvexDecompResult() method, to process the resulting convex pieces. For example create btConvexHullShapes out of them.

---JvdL---
Karrok
Posts: 65
Joined: Fri May 13, 2011 1:11 pm

Re: Convex Decomposition without wavefront?

Post by Karrok »

And the above can be done with a simple btCollisionShape object?
Because a btCollisionShape has no members to request all the information required to fill in the required members of a DecompDesc struct is there?

I have trimeshes of "unknown" shape variety. ie:

[arbitrary trimesh] -> {Black box of ConvexDecomp magic} -> [compound shape with convex subshapes]

This seems quite convoluted in the convex decomp demo/system.

Thanks for the input eitherway!
User avatar
jarno
Posts: 57
Joined: Tue Mar 16, 2010 1:42 am

Re: Convex Decomposition without wavefront?

Post by jarno »

The convex decomposition needs mesh data. The mesh has to be made from triangles, but it does not have to be one of Bullet's triangle mesh objects.

All the decomposition needs is the number of vertices in the input mesh, the number of triangles, and pointers to the array of vertex positions (3 floats per vertex) and array of indices making up all the triangles (3 integers per triangle, each indexing a vertex). As long as you can supply those from your mesh data, then your good to go.

One thing to look out for, which has bitten me several times, is that the convex decomposition will take into account all the vertices in the vertex array, even if a vertex is not actually used in any of the triangles.

---JvdL---