Thursday, April 28, 2011

Soft body manipulation with Phantom arm

From the last demo that I presented, I was working on the integration of the soft bodies in my application. I found it extremely difficult to achieve, due to the fact that there is no documentation on world configuration, bodies configuration and so on.

In the end, I managed to integrate soft bodies, trying this and that, using a so called technique of "try and see".

Here is what I discovered during these days of using Bullet. There is the explanation, and some remarks.

There are two ways to do collision between rigidBody and soft body (that I discovered):
1. register only VF_SS, but in such case no btGImpactCollisionAlgorithm must be registered, otherwise no collision between soft and rigid from mesh will be done. Also no clusters must be used. Better simulation. No collision between concave rigid bodies will be present.
2. register CL_SS + CL_RS, generate clusters, and m_kLST = 1.0f (material) must be used. btGImpact collision algorithm can be used, thus all objects will collide. Worse soft body simulation than in the point1, but maybe this is because I used the same parameter values for the softBody configuration and material (better not from the point of performance, but visual results, because this second method is faster).

Remarks:
1. Every object in the scene must have the mass set depending on the volume of the object, but how to calculate this for the models that are imported from different model files, I don't know. (So it's up to you to decide, at import, the mass, based on the stability of the simulation)
2. The value of the force applied to the soft body must be based on the mass of the whole object. Otherwise the simulation may become unstable, objects blow up and disappear.
3. Bullet mixes up my vertex indexes at the creation of the softBody from a trimesh, so if I want to apply a texture on the softBody, it will not be applied correctly. I didn't figure out for the moment how to correct this. The only thing I can think about is to create a map, and to map every vertex of the softBody to the original index, but this will cost too mush computation performance. (The result of this can be observed in the video below)
4. Collision between softBody and other bodies is dependent of the tessellation, so you must find what's the best value for your case.
5. I must use collision margin for the soft bodies and rigid bodies of 0.5; I would like to know the relationship of the collision margin to the simulation stability, since if I leave collision margin = default, my soft bodies blow up. (No one on the bullet forum replied to this, so it's disappointing, and no solution for my case, of course, if I would spend some weeks trying to figure out what's the relationship, maybe I'll find it).
6. I can't move the soft body as I do in the case of rigid bodies, especially in the case of torque. There is no such functionality to get the current velocity of the entire soft body (we can access the velocity for every single node instead), and we can't apply a torque on the body, as in the case of the rigid bodies. In the case of the movement, Hooke's law and damping effect do they work.

And here is what I achieved (The application performance is very low because the haptic rendering, graphic rendering and simulation is done on the same thread. Using glut, that's the problem. Must change.):

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.