How to deal with Rigid and softbody interaction

Please don't post Bullet support questions here, use the above forums instead.
fishboy82
Posts: 91
Joined: Wed Jun 10, 2009 4:01 am

How to deal with Rigid and softbody interaction

Post by fishboy82 »

Sorry for ask such a stupid question. I want to knwo how to deal with Rigid body and soft body 's interaction.for example a soft body may have it's own constraint(volume,Pressure,etc)
and bunch of rigid bodys may also have their constraint(Joint,contact,etc) .
The problem is how to calculate the constraint force between rigid body and soft body. because I want to solve the Rigid body's constraint indepedent of the Soft body's constraint Solver .
That is
1.Solve all rigid body'd constraint
2.Solve all soft body's constraints
So what the third step is ? Is it Solve the Soft body&Rigid body's constraint , But when solve them it also may cause the already solved constraint be breaken. I don't know how to do
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: How to deal with Rigid and softbody interaction

Post by Dirk Gregorius »

I think there are two possibilities (but I am no expert here). You can either solve all constraints together which should give the best results I guess. The other one is to use impulses between the soft bodies and rigid bodies. I think I have read that Bullet uses this approach and it seem to work in practice.
fishboy82
Posts: 91
Joined: Wed Jun 10, 2009 4:01 am

Re: How to deal with Rigid and softbody interaction

Post by fishboy82 »

Thanks a lot Dirk:
So I will read the bullet's code first, but before I do that .Could you give me a brief explantaion how this is done, for example if I have a point in a softbody fixed in a rigidbody's point so after the rigidbodies constraint solver and the softbodie's constraint solver these two points velocity constraint's may be breaken,right? If this happen then we will apply some impluse to corret the error?
Will this be like
1.Solve RigidBody Constraints
2.Solve SoftBody Constraints
3.Apply Impluse to Correct the constraints error between Rigid Body and SoftBody
4.intergrate velocity of all the Rigid Body and Soft Body
?
fishboy82
Posts: 91
Joined: Wed Jun 10, 2009 4:01 am

Re: How to deal with Rigid and softbody interaction

Post by fishboy82 »

By the way Dirk:
Do you know how current commercial Physics Engine like phyx,havok, etc Deal with RIgid and SoftBody,by use which method ,solve them together or like Bullet solve them independently and apply impluse
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: How to deal with Rigid and softbody interaction

Post by Dirk Gregorius »

I know, but as you can imagine I cannot speak about such stuff :)
fishboy82
Posts: 91
Joined: Wed Jun 10, 2009 4:01 am

Re: How to deal with Rigid and softbody interaction

Post by fishboy82 »

:lol:
Ok , So forget my question,Dirk. haha ,But could you answer my previous question:
Thanks a lot Dirk:
So I will read the bullet's code first, but before I do that .Could you give me a brief explantaion how this is done, for example if I have a point in a softbody fixed in a rigidbody's point so after the rigidbodies constraint solver and the softbodie's constraint solver these two points velocity constraint's may be breaken,right? If this happen then we will apply some impluse to corret the error?
Will this be like
1.Solve RigidBody Constraints
2.Solve SoftBody Constraints
3.Apply Impluse to Correct the constraints error between Rigid Body and SoftBody
4.intergrate velocity of all the Rigid Body and Soft Body
?
Is my understand right? Thanks
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: How to deal with Rigid and softbody interaction

Post by Dirk Gregorius »

Of course you could setup constraints between particles and rigid bodies and then solve these constraints in the same loop and your "normal" rigid body constraints. You need a general constraint solver for that and this should be possible. On the other side soft bodies and rigid bodies use usually some different approach in their solver (position based and velocity based).

So just look how the coupling is done e.g. in Bullet, play around and try to improve it. You could for e.g. try this (not tested, just an idea):

for ( n iterations )
{
solveRigidBodyConstraints();
solveSoftBodyConstraints();
interactMagicallyBetweenRigidBodiesAndSoftBodies();
}

Be creative :)

-Dirk
fishboy82
Posts: 91
Joined: Wed Jun 10, 2009 4:01 am

Re: How to deal with Rigid and softbody interaction

Post by fishboy82 »

Thanks Dirk:
I am also consider about how to coupling with different solver velocity level(rigid body) and position level(soft body) if I solve rigid and soft together. So the "general constraint solver " as you said I think should be do possible convert from velocity changed to position changed for example after in one iterator loop we use velocity solver for rigid bodies,and position solver for soft bodies . before solve the constraint between rigid and soft we should do some convert that change the velocity to position for rigid body or position to velocity for soft body and then could we do the constraint solver between rigid and soft .I think that is
interactMagicallyBetweenRigidBodiesAndSoftBodies(
should do . Of course this is my assumption there must exists more good method, any way I will do my best like you said "Be creative " to find some more good method in the furture, haha
raigan2
Posts: 197
Joined: Sat Aug 19, 2006 11:52 pm

Re: How to deal with Rigid and softbody interaction

Post by raigan2 »

One the topic of combining rigid+soft simulation, you might also be interested in David Wu's method, which is to have constraints work with an abstract "Degrees of Freedom" interface so as to be agnostic about the specific type of bodies being constrained:

http://pseudointeractive.com/technology-research.php
fishboy82
Posts: 91
Joined: Wed Jun 10, 2009 4:01 am

Re: How to deal with Rigid and softbody interaction

Post by fishboy82 »

Thanks raigan2 :
Could you tell me in which GDC paper of David wu that contains what you said
abstract "Degrees of Freedom" interface
,or should I read all his paper?
bone
Posts: 231
Joined: Tue Feb 20, 2007 4:56 pm

Re: How to deal with Rigid and softbody interaction

Post by bone »

I read through most of the first document at that link and didn't find it. However, I can tell you that I've somewhat successfully done something similar by making a point mass be a base class for a rigid body. Without even using virtual functions, I can use (some) generic constraints on either.
raigan2
Posts: 197
Joined: Sat Aug 19, 2006 11:52 pm

Re: How to deal with Rigid and softbody interaction

Post by raigan2 »

fishboy82 wrote:Thanks raigan2 :
Could you tell me in which GDC paper of David wu that contains what you said
abstract "Degrees of Freedom" interface
,or should I read all his paper?
I'm sorry for being so vague, here are the specific papers:
http://pseudointeractive.com/files/CelD ... DC2002.ppt
http://pseudointeractive.com/files/Phys ... DC2003.doc
http://pseudointeractive.com/files/Char ... ch2004.ppt

The other ones are definitely worth reading. Also sadly none of them get into implementation details so it's still rather vague, but hopefully it gives you some ideas.

My implementation is that constraints are aware only of dC/dX, the Jacobian of the constraint wrt some idealized state X (i.e worldspace positions, worldspace directions, etc), and specific DOFs know dX/dP, the (mass-weighted) Jacobian of X wrt the actual DOF P, so you can then build dC/dP = dC/dX*dX/dP to solve the constraints without explicitly writing out all possible combinations of C and P.

Of course it's probably faster to directly implement all the necessary dC/dP formulae, but this leads to a combinatorial explosion of constraint functions so in some cases isn't practical.

I have no idea if the way we're doing things makes sense though, quite possibly it's terrible and/or confused!! :)
fishboy82
Posts: 91
Joined: Wed Jun 10, 2009 4:01 am

Re: How to deal with Rigid and softbody interaction

Post by fishboy82 »

Thanks raigan2, I will read these presentation first,
Hi Bone, as you said
Without even using virtual functions, I can use (some) generic constraints on either.
,so is you method the same idea like raigan2's?
bone
Posts: 231
Joined: Tue Feb 20, 2007 4:56 pm

Re: How to deal with Rigid and softbody interaction

Post by bone »

fishboy82 wrote:so is you method the same idea like raigan2's?
It doesn't sound like it unless I'm mis-reading. My constraints are aware of more than just the Jacobian - I'm using SI and letting the constraints build the Jacobian and apply impulses and position corrections. Mind you, my system is a work-in-progress, but I have some trilateral and quadrilateral (sp?) constraints so it seems like the easier way to go.
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: How to deal with Rigid and softbody interaction

Post by Dirk Gregorius »

So you are solving positons and velocties simulataneously?

Example:
for all constraints c
....SolveVelocity( c )
....SolvePosition( c )


Cheers,
-Dirk