Deformable Bodies

psquare
Posts: 6
Joined: Wed May 13, 2009 4:25 am

Deformable Bodies

Post by psquare »

Hello All. First post here. Please bear with me if some of the questions are 'newbie'

I am trying to incorporate soft body physics from bullet along with Ogre for a medical simulation app. We basically have a a heart model. It is to interact with medical instruments in a realistic fashion. That is to say, it should respond to prodding/poking, grasping/pinching by the medical instrument. We are using Bullet's soft body API for this.

Queries:

-btSoftBody::generateBendingConstraints seems to take an inordinate amount of time for a complex model. Should I be using a low res model for feeding to bullet. If I do this, I don't know how to map the deformations from the lower res physics mesh to the high res graphics/ogre mesh. In fact, is this even normally done for a deformable object? Using low res models for rigid bodies is clear. Can I get away with not using generateBendingConstraints, and just using shape matching (see next point)

-I also noticed that when shape matching is used (btSoftBody::setPose), generateBendingConstraints is not used. Are these 2 things mutually exclusive? Also, I can't really understand what the 2 arguments for setPose do.

-Clusters:This is more of a physics question than bullet related question. What is the basic idea behind clusters, and their relation to soft bodies, shape matching, etc? In what cases is clustering more beneficial, and in what cases not needed? I noticed that some papers linked here on the forum mention clusters, but I am unsure whether they mean the same thing in bullet.

-Animations:This is the next step actually. (We are first testing with no animations). We basically want the deformations combined with animations. That is, in areas where the organ is not colliding/constrained by the instrument, it should be 'chasing' the animation keyframes. How do I combine the deformable collision responses from bullet alongside this pose animation. Looking around the forum I found that this is a active research area. What are some of the reasonable methods to do this?

Also, any input/feedback from people who have done something similar is welcome.
psquare
Posts: 6
Joined: Wed May 13, 2009 4:25 am

Re: Deformable Bodies

Post by psquare »

Anybody? :(
julyaxess
Posts: 1
Joined: Mon Jul 20, 2009 2:14 pm

Re: Deformable Bodies

Post by julyaxess »

You are trying to incorporate soft body physics from bullet along with Ogre for a medical simulation application and basically have a heart model, then what had happen??

________________
Ultrasound repair
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: Deformable Bodies

Post by Flix »

I'm not able to answer to most of your questions (so I will leave them unanswered), but you asked:
Should I be using a low res model for feeding to bullet.
Well, of course the answer should be no, unless you can handle the overhead of vertex mapping and interpolation (to find the positions of the vertices you have excluded from the Ogre model).

But I think that to improve performance you could try to:
1) Remove double vertices from your Ogre model to feed the Bullet engine and "restore" them back when you update the Ogre mesh. (usually .mesh and .x models needs many double vertices to perform texture mapping: that does not happen with OpenGL models).

2) Refresh the Ogre mesh (i.e. the position of the vertices) less frequently. (This will help if Ogre is the bottleneck).

In order to achieve step 1, you could for example move the double vertices to the end of the mesh (updating the indices and reoptimizing them at the end by shuffling them with an Ogre API method). This way you have a mesh that you can more easily split to feed the Ogre engine and update back from Bullet to Ogre (by assigning to the last vertices the correct values).

I believe this is one of the easiest way of doing it (although it is NOT easy at all IMO), because you can just use a std::vector< unsigned short > to map the last vertices of the mesh with the "single" ones at the beginning and you don't need to use any std::map<> at all.

Hope it helps.

P.S. If you mesh has multiple submeshes, you need to move all the vertices to the "shared vertices" area, updating the indices, before starting step 1.
julia
Posts: 8
Joined: Fri Mar 19, 2010 9:16 am

Re: Deformable Bodies

Post by julia »

Hi,

i'm also working on medical simulation and try to implement picking a softbody. I tried to do this like the picking in the SoftDemo and set the position and the velocity of the picked node like this:

Code: Select all

btVector3 delta= device->m_x - m_node->m_x;
m_node->m_x =  device->m_x;
m_node->m_v += delta/timeStep;
The problem is that the picked node doesn't hang directly on my device, but with offset, which looks a bit strange during a medical simulation ;-)
I also tried to set the mass of the node to 0. This solved the displacement problem, but caused a strange deformation of the whole body.

Do you have an idea how to solve this problem?

Thanks
billias13
Posts: 18
Joined: Thu Mar 22, 2012 9:29 am

Re: Deformable Bodies

Post by billias13 »

did you ever find a solution to this problem?