Limit softbody deformations

Post Reply
ca$per
Posts: 35
Joined: Fri May 21, 2010 2:48 pm

Limit softbody deformations

Post by ca$per »

Hi!
Is it possible to somehow limit softbody deformations? I'll try to explain with pictures.
Here we have sails (btSoftBody) and wind (addForce) blowing in direction of a ship:
wind_1.jpg
wind_1.jpg (277.42 KiB) Viewed 14073 times
And here the ship is turned 180 degree and face the opposite direction of the wind. So the sails are bending in the wrong direction actually:
wind_2.jpg
wind_2.jpg (265.34 KiB) Viewed 14073 times
The question is, how to smoothly limit this bending? Not just force them to stay like wood when turned against the wind (did this by limiting nodes coordinates directly). But smoothly limit the bending.
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: Limit softbody deformations

Post by Flix »

Nice ship :)

I can't be very helpful, since I'm not using btSoftBodies much at the moment... anyway I try.
ca$per wrote:how to smoothly limit this bending?
Well, as far as I remember the only way is to enable "shape matching", and limit the elastic constants of the links a bit (this can probably be done in a selective way, although it's very difficult to set up the correct values).
I don't remember the correct Bullet methods to enable it, but I do remember that "shape matching" keeps the original shape intact during deformations (to use it you probably need to change the model of your sails to start with an initial "bending" hardcoded in it).

Anyway I wouldn't do it (sails must be free to bend in any direction: your simulation seems 100% correct to me: with the wind in front of them sails shouldn't stay in that position in my opinion).
Maybe you can still tune the elastic constants of the links, but that will still be in both directions, and thus useless (unless you can change them at runtime, but I don't know if it is possible, and if it is, it might be a bit complicated...).

... not very helpful indeed :oops:
ca$per
Posts: 35
Joined: Fri May 21, 2010 2:48 pm

Re: Limit softbody deformations

Post by ca$per »

Thanks for the tip. I tried to use pose matching, just to see how it will look, but it doesn't seem to work. And yes. If there is a possibility to limit, it should be only from one side.
The problem is that when sail is bend back, it penetrates the mast. To avoid that i would have to add rigid bodies for all geometry of the ship or at least for all masts. That's a big number of polygons, since they are not convex. I'm also not able to add convex shapes by hands, simply because there are already 100 ships made. So i thought maybe there is an easy solution for deformations limiting.
jeti
Posts: 6
Joined: Tue Sep 07, 2010 10:35 pm

Re: Limit softbody deformations

Post by jeti »

Hmmm, on a real ship the yards (the horizontal bars) would spin around the mast if the wind changes to that direction... But probalby those are fixed in you model? Are you going for a more or less realistic sailing simulation? The terrain in the screenshot looks like it is rather some kind of board game^^

Anyway great ship! and you have 100 of them? :O
ca$per
Posts: 35
Joined: Fri May 21, 2010 2:48 pm

Re: Limit softbody deformations

Post by ca$per »

The "terrain" is just a meter grid )).
The ship will have turning yards, falling masts, folding/unfolding sails and "tearing" ropes. And yes. 100 of them.
The problem is that it is all working with a use of skinning for sails and ropes. Meaning, that wind waving animation is repeating itself. What i want is get rid of skinning and use Bullet for cloth. But i don't know how to do it with a better way. What i don't know how to solve is:
1. limit sails with their bending backwards, so they wouldn't penetrate the mast;
2. attach ropes as they are in the model, so they would stretch when yard turns.
The most hardest is to make all these things at least semi-automatic. Meaning, that we can't afford our artists to tune all parameters, like where each rope is, etc. I have to identify rope from a model (i can do that) and sails (also doable). And then apply Bullet physics on them.
For example sails are folding/unfolding with a skinning animations. So there are bones attached to each sail. How to make folding/unfolding when sail is replaced with a soft body?
Also i tried treating ropes as another soft body (i don't know how to render them if i use Bullet's ropes) and attach to corners of the sail (i know which vertices are at the corner). So there would be 2 soft bodies and i need to link their nodes. It worked.... some how. But looked terrible. Ropes were acting like pieces of steel, dragging sail downwards. But their mass was too low for this.
Another words, i'm lost on this. Bullet's physics works great and with a better performance then skinning, but how to use it?
jeti
Posts: 6
Joined: Tue Sep 07, 2010 10:35 pm

Re: Limit softbody deformations

Post by jeti »

hmm I'm afraid I have no idea to solve your problem...
but I wonder how your ships are moved... if its like using the mouse to specify a target location and the unit turns and moves there, you might have a hint for me how to get my units move properly ( see: http://bulletphysics.org/Bullet/phpBB3/ ... f=9&t=5643 )?
ca$per
Posts: 35
Joined: Fri May 21, 2010 2:48 pm

Re: Limit softbody deformations

Post by ca$per »

Actually we are developing a sailing game, not RTS. Thus ship is controlled with keyboard, like fold/unfold sails, turn them. Only these controls. The ship is moved by the help of a special movement formula, that accounts for wind, mass, drag and many-many other parameters.
robagar
Posts: 48
Joined: Fri May 21, 2010 1:49 am

Re: Limit softbody deformations

Post by robagar »

hey ca$per - FWIW I'm doing something very similar with softbody sails on a small sailing boat, and I've hit the same problems.

1. rigid bodies penetrate soft bodies (ie the collision response is not strong enough)
2. soft bodies are way too stretchy, like very thin rubber, regardless of the material settings
3. rigid body - soft body anchor points are fixed in place, making it difficult to do things like hoisting or reefing a sail

From what I can make out from the rather cryptic source code, there's no simple fix. If you've got the time, I'd think about rolling your own cloth physics. That's my plan at least...
ca$per
Posts: 35
Joined: Fri May 21, 2010 2:48 pm

Re: Limit softbody deformations

Post by ca$per »

Unfortunately, creating our own cloth will kill the project. That is why i need to find another way around.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Limit softbody deformations

Post by Erwin Coumans »

1. rigid bodies penetrate soft bodies (ie the collision response is not strong enough)
2. soft bodies are way too stretchy, like very thin rubber, regardless of the material settings
3. rigid body - soft body anchor points are fixed in place, making it difficult to do things like hoisting or reefing a sail

From what I can make out from the rather cryptic source code, there's no simple fix. If you've got the time, I'd think about rolling your own cloth physics. That's my plan at least...
The Bullet soft body implementation could use some attention and improvement indeed. The innerloop of the cloth simulation isn't very complicated. In Bullet 2.77 we abstracted this part, so it can run on GPUs. Hopefully this makes it easier to tune and improve the behavior.

It is not clear yet if the problems you mention such as stretchyness, are a problem with the implementation (better tuning/more iterations etc) or the algorithm.
If you make some improvements, please consider contributing the improvements back.

Thanks,
Erwin
shomy2k11
Posts: 24
Joined: Thu Sep 08, 2011 1:59 am

Re: Limit softbody deformations

Post by shomy2k11 »

Hi,
I'm interested in some of your wind calculation source code for my game http://bulletphysics.org/Bullet/phpBB3/ ... 24&e=25324 . I was hoping you could help me out with some code for wind which allows me to change its direction, force and pulsed forces. Drop me a line please.
Post Reply