Collision interpentrated mesh, distance, convex decomp patch

tuan kuranes
Posts: 10
Joined: Mon Sep 04, 2006 1:40 pm
Location: Grenoble, France

Collision interpentrated mesh, distance, convex decomp patch

Post by tuan kuranes »

1) Collision only, not dynamic, when two mesh are deeply in collision it is very, very slow.
I guess that comes from contact generation, but in my collision envirronement, contact are not interesting at all...
Can I limit the contact number, or even disable contact generation ?

2) I added convexDecomposition to OgreBullet.
I'd like to add minimum distance computation between two "convex decompositonned" mesh, but it's slow because I use "brute force" distance from "n child" to "n child" of each compound shape resulting of the decomposition.

Is there something I can do ? Perhaps a "first step" algorithms to restrain to "nearest child" to "nearest child" or something ?

3) I have an optimisation patch for convexdecomposition that saves an awful lot of dot(), should I post a patch to the "codesuppository" tracking system, to bullet tracking system or both ?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Collision interpentrated mesh, distance, convex decomp patch

Post by Erwin Coumans »

1) Collision only, not dynamic, when two mesh are deeply in collision it is very, very slow.
Can I limit the contact number, or even disable contact generation ?
Usually collision detection between non-dynamic objects is disabled. How are you using the concave mesh collision detection, just like a boolean sensor/trigger? Do you use a GIMPACT shape? You can't use convex decomposition?
2) I added convexDecomposition to OgreBullet.
Bullet has the btCompoundShape, you can add convex shapes (btConvexShape) to it. When two compound shapes collide, it uses a dynamic tree structure, btDbvt, for culling children combinations. Are you using btCompoundShape to store your convex parts?
3) I have an optimisation patch for convexdecomposition that saves an awful lot of dot(), should I post a patch to the "codesuppository" tracking system, to bullet tracking system or both ?
If you have some optimization, please file an issue in the Bullet issue tracker. Our implementation forked/diverged from the original code suppository and we don't sync up. So you might want to file it also to codesuppository (also in Google Code now).
Thanks,
Erwin
tuan kuranes
Posts: 10
Joined: Mon Sep 04, 2006 1:40 pm
Location: Grenoble, France

Post by tuan kuranes »

1) sadly not for collision, I have to use Gimpact Shapes due to "high precision" request, and "dynamicness" of mesh (cannot refine manually for each mesh each parameter, and check if it's ok...)
(anyway convex does improves things a bit but it still impact fps when two shapes are "very" overlapped.)

2) it's for Distance only no collision at all (I could cull particular case min distance of 0 using collision check though).
I do store convex part into btCompoundShape.
As I'm only looking for minimum distance bewteen the two mesh (2 compound shape with only convex child), I still have to iterate over each child to compute min distance between each shapes.

3) done : http://code.google.com/p/bullet/issues/detail?id=199 . Will do for "codesuppository" source project, but it seems I have to get and compile everything as it all changed...

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

Re:

Post by Erwin Coumans »

tuan kuranes wrote:1) sadly not for collision, I have to use Gimpact Shapes due to "high precision" request, and "dynamicness" of mesh (cannot refine manually for each mesh each parameter, and check if it's ok...)
Can you explain more in detail? If is it not for 'collision' (why do you mean by that? ' collision' refers to 'collision query' like 'getclosestpoints', or boolean 'hasOverlap'?) and not a dynamic right body dynamics simulation ('dynamic' as in an actively moving object), what are you doing with a btGimpactShape?
2) it's for Distance only no collision at all (I could cull particular case min distance of 0 using collision check though).
I do store convex part into btCompoundShape.
Ah, you need a distance query between compound shapes? That feature isn't in Bullet right now indeed, only touching contact/penetration is detection. If you only need fairly small distances, you could enlarge the bounding volumes, and re-use the current Bullet implementation. Otherwise, if you need far distances, the closest point query can be accelerated using the btDbvt data structures, and keeping track of the current closest distance (don't traverse the a branch if the distance to the bounding volume of the branch is greater than the current closest distance. You only need the closest distance, right?).
3) done : http://code.google.com/p/bullet/issues/detail?id=199 . Will do for "codesuppository" source project, but it seems I have to get and compile everything as it all changed...
Thanks a lot, we'll look into it,
Erwin
tuan kuranes
Posts: 10
Joined: Mon Sep 04, 2006 1:40 pm
Location: Grenoble, France

Re: Collision interpentrated mesh, distance, convex decomp patch

Post by tuan kuranes »

Sorry I totally misphrased that. complete sentence is "sadly cannot use convex decomposed shapes for collision instead of concave gimpact shapes" As they are "dynamic" (as in I don't know what kind of mesh can end in the process of collision detection, so dynamic input (no physic involved here))

To ease description : Think of real machine with driven heavy parts (inertia) using joystick, machines handling any kind of materials.
I want to warn before collisions (using closest distance) and in "simulator" mode show collided "parts" when joystick handler people are no listening to warnings.

Basically it's 2 different needs :

- detect collision with concave shapes as I need precision and to be able to handle all kind of shapes, that works but get hard fps impact when 2 mesh overlapping a lot (both high triangle count), no real fps impact otherwise. Seems to me that stopping trying to generates contact/manifold as soon as collision is detected would do for me here, but I'm not expert...

- get closest distance between 2 mesh (decomposed into convexes shapes under compound shapes) with "some" precision. Idea being to be able to "avoid" collision using that info. Works well and reasonnably fast even if brutre force for now. Only need the closest distance, but distance can be from mm to a few meters. So I'll think I'll have a look in btDbvt then.


Thanks for you patience !
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Collision interpentrated mesh, distance, convex decomp patch

Post by Erwin Coumans »

tuan kuranes wrote:Sorry I totally misphrased that. complete sentence is "sadly cannot use convex decomposed shapes for collision instead of concave gimpact shapes" As they are "dynamic" (as in I don't know what kind of mesh can end in the process of collision detection, so dynamic input (no physic involved here))

To ease description : Think of real machine with driven heavy parts (inertia) using joystick, machines handling any kind of materials.
I want to warn before collisions (using closest distance) and in "simulator" mode show collided "parts" when joystick handler people are no listening to warnings.
Ah interesting, so this sounds like haptic feedback: the user moves objects, and in "simulator" mode it shows collided parts. But the simulation mode is not allowed to stop at the time of impact (and prevent penetration), right? There is a way to only report the overlapping triangles, and not generating contacts etc.

If you need help with (1) reporting only the overlapping triangles between two concave triangle meshes, or (2) optimizing the closest distance between two compound shapes, please ask (detailed questions),
Thanks,
Erwin