Softbody bug? Fit softbody rabbit mesh inside a tube mesh

lakeeast
Posts: 5
Joined: Sun Mar 30, 2008 7:07 am

Softbody bug? Fit softbody rabbit mesh inside a tube mesh

Post by lakeeast »

A project I was working on involves deploying a soft body object inside another concave mesh object. As a new user of Bullet, I downloaded the latest Bullet 2.68 library and implemented a simple application based on the appSoftBodyDemo example. The goal of the prototype application is to fit a rabbit-shaped soft body mesh object inside a tube-shaped mesh object. But I didn't have much success: the rabbit mesh consistently leak out of the surrounding tube mesh object, and I am suspecting that it is caused by bugs in the bullet soft body library.

Here are two images I captured to show the problem:
Picture 1: softbody tube and softbody rabbit
Image

Picture 2: rigidbody tube and softbody rabbit
Image

I am looking for help to solve the leakage problem, and your insights are sincerely appreciated! Source code is attached for your reference. In order to select different types of tube meshes for testing (softbody mesh vs. GImplact rigidbody mesh vs. solid object etc), you need to adjust the following code:

Code: Select all

static void	Init_RabbitTube(SoftDemo* pdemo)
{
    //Step 1: model ground with rigid body
    init_ground_rigid(pdemo);

    //Step 2: model rabbit
    float rabbitMass = 10;
    btVector3 rabbitPosition(0,0,0);
    float rabbitScale = 4; //When data is loaded, the rabbit's height is about 1.
    init_rabbit_soft(pdemo, rabbitMass, rabbitPosition, rabbitScale);

    float tubeMass = 10;
    btVector3 tubePosition(0,0,0);
    float tubeScale = 1.0; //When data is loaded, the tube's length is 10 and radius is 5.

    //////////////////////////////////
    //Step 3: Choose one of the functions below to model tube.
    //Option 1: Solid tube
    //init_tube_solid(pdemo, tubeMass, tubePosition, tubeScale);

    //Option 2: Soft tube
    init_tube_soft(pdemo, tubeMass, tubePosition, tubeScale);

    //Option 3: Bvh mesh rigid tube
    //init_tube_rigid_BvhMesh(pdemo, tubeMass, tubePosition, tubeScale);

    //Option 4: GImpact rigid mesh
    //init_tube_rigid_GImpactMesh(pdemo, tubeMass, tubePosition, tubeScale);
}
Thanks for your help! If the leakage problem is resolved, my next challenge will be to fit the softbody rabbit mesh in a tube with changing diameters. The rabbit will be shrinking in size if the tube diameter is small. Any thoughts?

lakeeast
You do not have the required permissions to view the files attached to this post.
Nathanael
Posts: 78
Joined: Mon Nov 13, 2006 1:44 am

Re: Softbody bug? Fit softbody rabbit mesh inside a tube mesh

Post by Nathanael »

I have been able to reproduce the problems.

- Soft vs solid cylinder work as expected.
- Soft vs Bvh/GImpact mesh is not yet implemented.
- Soft vs Soft is at a very early stage of development, and is currently very unstable.

Improvement of soft vs soft collisions is at the top of the priority list, and currently under development.

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

Re: Softbody bug? Fit softbody rabbit mesh inside a tube mesh

Post by Erwin Coumans »

FYI Bullet 2.69 adds preliminary support for soft body versus btBvhTriangleMeshShape.

Thanks,
Erwin
lakeeast
Posts: 5
Joined: Sun Mar 30, 2008 7:07 am

Re: Softbody bug? Fit softbody rabbit mesh inside a tube mesh

Post by lakeeast »

Thanks Nathanael and Erwin for your replies. It's nice to know that there is active development in the soft body area, and I cannot wait to see the new 2.69 release.

BTW, do you have recommendations on how to model an expanding tube? (E.g. Bhv vs. GImpact. Kinematic object vs. dynamic object. setLocalScale() vs. other mechnisms...)

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

Re: Softbody bug? Fit softbody rabbit mesh inside a tube mesh

Post by Erwin Coumans »

We focus is on core Bullet (under /src folder), there are short term plans for btBvhTriangleMeshShape versus soft body, but not GIMPACT.

You can model an expanding tube using btBvhTriangleMeshShape by animating the vertices and refitting the tree.

Check out Bullet/Demos/ConcaveDemo/ConcavePhysicsDemo.cpp, you can pass in the extends of a local deformation of the btBvhTriangleMeshShape, or do a full refit.

Code: Select all

trimeshShape->partialRefitTree(aabbMin,aabbMax);
//slower
trimeshShape->refitTree();
Thanks,
Erwin
lakeeast
Posts: 5
Joined: Sun Mar 30, 2008 7:07 am

Re: Softbody bug? Fit softbody rabbit mesh inside a tube mesh

Post by lakeeast »

Thanks Erwin!