Triangle meshes

Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Triangle meshes

Post by Dirk Gregorius »

Bullet has support for quite a lot of types of triangle meshes:

Convex:
btConvexTriangleMeshShape
btConvexHullShape

Concave:
btTriangleMeshShape
btBvhTriangleMeshShape


The simple convex shapes seem to use brute force testing for all vertices and there seems to be no optimization like e.g. hill-climbing. What are typical use cases for the above shapes? So for simple (convex) primitives with a moderate number of vertices I would use either btConvexHullShape or btConvexTriangleMeshShape depending on whether the mesh data can be shared. For huge triangle meshes (e.g. 50000 vertices) I use then some BVH mesh?

What is the typical limit for a convex hull mesh with/without using some hill-climbing method? Does those hill-climbing methods actually make sense when using BVH?

And how are the found triangles from the BVH handled? Are all possible triangles from the tree tested against whatever primitive using GJK then? How many maifolds will be created in this case?

Cheers,
-Dirk
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

There are several concepts for collision meshes:

- dynamics (moving) versus static (= not rotating and not translating) shapes.
- re-use graphics (triangle) data versus duplicating.
- concave versus convex
- vertex deformation (full or partial refitting the graphics mesh into the collision shape)
- concave compounds of convex parts (from convex decomposition), concave btCompoundShape


As a rule-of-thumb:

Use a btConvexHullShape for moving convex meshes, duplicating the vertices (point cloud). In my experience brute force is faster and recommended over anything more 'clever' (like hill climbing, Dopkin Kirkpatrick hierarchies etc) when using less then 100 vertices. If you need more details (not recommended) use compounds of simpler convex parts.

For static meshes, use compressed/quantized btBvhTriangleMeshShape. This supports real-time local vertex deformation through partialRefit.
And how are the found triangles from the BVH handled? Are all possible triangles from the tree tested against whatever primitive using GJK then? How many maifolds will be created in this case?
1 manifold. I tried multiple manifolds in the past, but didn't notice much difference, so unless users start complaining, we can stick with contact manifold per collision pair. So simplicity over complexity.

Hope this helps,
Erwin
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Post by Dirk Gregorius »

Just out of interest. Would the btBvhTriangleMeshShape also work with cloth collision and self-collision?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

btBvhTriangleMeshShape might be a good starting point, but it would require some improvements. Right now, only single aabb query versus tree is supported. Tree versus tree (recursive or iterative) needs to be added, and some other.

When we get to cloth support, I'll probably get back to this.