Softbody bounces back too fast and weird?

bunengzaicai
Posts: 15
Joined: Sun Feb 15, 2009 3:42 am

Softbody bounces back too fast and weird?

Post by bunengzaicai »

I loaded a model with triangle meshes from outside and tried it in SoftDemo.cpp with current_demo=26 (torus's pack). Actually, I just replaced the torus data with mine and modified mass from 56(?) to 1.
Something weird happens to this program:
1.softbody bounce back very fast in a strange way;
2.some of softbodies twist like a thin paper;
I know I should set some parameters of it, but I can not find any hint from docs
Which parameter should I adjust to make softbody "harder"?

In addition, my model is of high-ratio one(height:length:width=1:10:1);

Any suggestion?
bunengzaicai
Posts: 15
Joined: Sun Feb 15, 2009 3:42 am

Re: Softbody bounces back too fast and weird?

Post by bunengzaicai »

Anybody knows?
Thanks.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Softbody bounces back too fast and weird?

Post by Erwin Coumans »

It is best to experiment and compare your setup with the soft body demos. The most important settings to control stiffness are the linear stiffness in the material, called m_kLST. Values closer to 1 make it more stiff:

Code: Select all

//given a btSoftBody* psb
btSoftBody::Material*	pm=psb->m_materials[0];
pm->m_kLST=1.f;
Also enabling bending constraints and shape matching makes it more stiff:

Code: Select all

//create bending constraints
	psb->generateBendingConstraints(2,pm);
//enable shape matching
	psb->setPose(false,true);
//experiment with the following value (in range 0..1)
	psb->m_cfg.kMT = 1.f;
Hope this helps,
Erwin
bunengzaicai
Posts: 15
Joined: Sun Feb 15, 2009 3:42 am

Re: Softbody bounces back too fast and weird?

Post by bunengzaicai »

Thank you for your reply.
That help much.
Objects collide with each other in a normal way for about 20 seconds and suddenly fly away again.
But, large bodies' behavior are better than smaller ones.
I want to know if triangle meshes' penetration make them fly away?
Could you suggest any function references of bullet?
Thanks again.
falcosolitario
Posts: 5
Joined: Mon Feb 16, 2009 11:13 am

Re: Softbody bounces back too fast and weird?

Post by falcosolitario »

Could you please tell me if you are using a NVIDIA card or if you are trying to achieve this under osx?
I have a similar problem and the main conditions are these ones, and i have already tried almost every combination for the softbody parameters... sometimes the softbody react well, other times it disappear, other times it behaves in a very weird mode...
bunengzaicai
Posts: 15
Joined: Sun Feb 15, 2009 3:42 am

Re: Softbody bounces back too fast and weird?

Post by bunengzaicai »

Yes, I am using NVIDIA card now.
I found a solution,that is:
Do not make any slim triangles, and try to keep all angles more than 30°.
It works in most cases, but didn't solve that problem.
falcosolitario
Posts: 5
Joined: Mon Feb 16, 2009 11:13 am

Re: Softbody bounces back too fast and weird?

Post by falcosolitario »

bunengzaicai wrote:Yes, I am using NVIDIA card now.
I found a solution,that is:
Do not make any slim triangles, and try to keep all angles more than 30°.
It works in most cases, but didn't solve that problem.
ok so we have something in common
Actually i'm using a nvidia 8800 gts card, with the latest driver.
From what i have seen here debugging like crazy the situation for me is the following
i create a softbody with the trimesh and i render it through my engine (for all the rest the engine is perfect, i mean, no error, render is good).
When the softbody collide with a static one i have 2-3 cases, depending also from the model and from the parameters
first one the model istantly disappear (well, first it slow down), second one the model deform in a pico-second in a very weird mode and then disappear and the driver crash.
Now, i have checked almost everything. vertex number is not changed, index is ok, so it seems that the collider generate invalid data for the opengl driver to display. I mean something like a huge float behing immagination...
This is my situation. Now i have stopped debugging it because i have to finish another part of the engine, but i'm still looking for a solution.
The funny thing is that with the 8800 gts i have these result, with an ati 1950, same program , same model, same paramters, it displays correctly, (both under winxp).
Under OSX it simply disappear without driver crashing (and the card is ati)
So i'm pretty confused.
as you have pointed out it seems also related to the construction of the model, but i wasn't able to find a 'rule' for this.
bunengzaicai
Posts: 15
Joined: Sun Feb 15, 2009 3:42 am

Re: Softbody bounces back too fast and weird?

Post by bunengzaicai »

That rule is not a real one.
It is because when I modified triangles from silm to regular, it's motion is better.
I will check it in another computer with ATI.
marshall
Posts: 7
Joined: Wed Jun 13, 2007 6:14 pm

Re: Softbody bounces back too fast and weird?

Post by marshall »

My general experience with softbodies:

1) We don't use the generate bending constraints. Unfortunately
this gets really slow when the geometry is complicated. Instead
we are using a nearest neighbor search to generate links (using a
kdtree). By placing a max neighbors constraint on a kdtree search
we've gotten much faster and more stable results.

Another nice benefit of this method is that you can specify regions
of a model to have more or less links. This gives you good control
and allows for variation across your model.

2) Make sure your mesh is triangulated uniformly. In our case our
geometry can be extremely heavy with odd triangle aspect ratios.
To deal with this we use a simplified proxy object for the simulation
then deform the original heavy geometry by binding it back to
the simplified version (using barycentric coordinates).

3) Increasing the position solver iterations (default is 1) makes the
simulation more stable. For realtime apps this may not be an option?

4) Using clusters, a single cluster is stiffer. More clusters make the
object softer.

5) As noted, increase the linear stiffness coefficient. It works better
if you have a good distribution of links (see 1 and 2 above).

In our application it's not necessary for us to run in realtime so some
of these may not be an option for you.