Collision detection for drilling simulation

Ally_Barrow
Posts: 2
Joined: Thu Jan 24, 2008 1:21 pm

Collision detection for drilling simulation

Post by Ally_Barrow »

Hi there,

I’ve been using Bullet for haptic rendering very successfully for a while now and I’ve just moved on to a project for a dental training simulation.

I have a couple of questions regarding the most efficient use of Bullet for deformable collision detection, so if anyone’s still reading here goes:

The physics of drilling will be based on a tetrahedral mesh of the layers of the tooth. For graphics I simply maintain a list of the edge faces and update the whole list as and when required which isn’t too tricky for visual stuff (25Hz) but potentially time consuming for haptic rendering 1KHz+.

So question one is: would I get the best performance from Bullet passing it an updated surface mesh each frame or using the built in tetrahedral type and presumably let it figure out the surface itself?

Which leads on to question two: I notice there is updateBound for recomputing a vertex buffer once you’ve moved the vertices but no obvious method of actually rebuilding it dynamically, i.e. dealing with material removal rather than deformation typically requires specific vertices/faces/polyhedra to be deleted from the buffer which, I’m guessing would require a complete refit? Or is it as simple as calling updateBound no matter what I do to the vertex/index buffers?

Finally (honestly!) I’m really need to know which triangles I’m in contact with, not necessarily all, just the standard four contacts would be enough but to calculate the fracture mechanics I need to know the face I’ve hit. If I ask Bullet in the right way and say please will it tell me?

Any suggestions, pointers, complete answers with diagrams most welcome!

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

Re: Collision detection for drilling simulation

Post by Erwin Coumans »

Ally_Barrow wrote:So question one is: would I get the best performance from Bullet passing it an updated surface mesh each frame or using the built in tetrahedral type and presumably let it figure out the surface itself?
Best performance is if you use partialRefit, providing the bounds of the deformation. See ConcaveDemo how to use this.
Which leads on to question two: I notice there is updateBound for recomputing a vertex buffer once you’ve moved the vertices but no obvious method of actually rebuilding it dynamically, i.e. dealing with material removal rather than deformation typically requires specific vertices/faces/polyhedra to be deleted from the buffer which, I’m guessing would require a complete refit? Or is it as simple as calling updateBound no matter what I do to the vertex/index buffers?
Adding and removing triangles would require creating a new btBvhTriangleMeshShape from scratch. Another option is re-using some of the collision detection functionality of the new deformable bodies, but this is work in progress. The underlying acceleration structure (btDbvh, dynamic bounding volume hierarchy) supports adding triangles on-the-fly I think).
Finally (honestly!) I’m really need to know which triangles I’m in contact with, not necessarily all, just the standard four contacts would be enough but to calculate the fracture mechanics I need to know the face I’ve hit. If I ask Bullet in the right way and say please will it tell me?
CustomMaterialCombinerCallback in the Bullet/Demos/ConcaveDemo shows how to access partId and triangleId, for each contact callback.

Hope this helps,
Erwin
Ally_Barrow
Posts: 2
Joined: Thu Jan 24, 2008 1:21 pm

Re: Collision detection for drilling simulation

Post by Ally_Barrow »

That's great, thanks for your help.

Ally