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:
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:
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.
Limit softbody deformations
-
- Posts: 35
- Joined: Fri May 21, 2010 2:48 pm
Limit softbody deformations
You do not have the required permissions to view the files attached to this post.
-
- Posts: 456
- Joined: Tue Dec 25, 2007 1:06 pm
Re: Limit softbody deformations
Nice ship
I can't be very helpful, since I'm not using btSoftBodies much at the moment... anyway I try.
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
I can't be very helpful, since I'm not using btSoftBodies much at the moment... anyway I try.
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).ca$per wrote:how to smoothly limit this bending?
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
-
- Posts: 35
- Joined: Fri May 21, 2010 2:48 pm
Re: Limit softbody deformations
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.
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.
-
- Posts: 6
- Joined: Tue Sep 07, 2010 10:35 pm
Re: Limit softbody deformations
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
Anyway great ship! and you have 100 of them? :O
-
- Posts: 35
- Joined: Fri May 21, 2010 2:48 pm
Re: Limit softbody deformations
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?
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?
-
- Posts: 6
- Joined: Tue Sep 07, 2010 10:35 pm
Re: Limit softbody deformations
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 )?
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 )?
-
- Posts: 35
- Joined: Fri May 21, 2010 2:48 pm
Re: Limit softbody deformations
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.
-
- Posts: 48
- Joined: Fri May 21, 2010 1:49 am
Re: Limit softbody deformations
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...
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...
-
- Posts: 35
- Joined: Fri May 21, 2010 2:48 pm
Re: Limit softbody deformations
Unfortunately, creating our own cloth will kill the project. That is why i need to find another way around.
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Limit softbody deformations
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.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...
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
-
- Posts: 24
- Joined: Thu Sep 08, 2011 1:59 am
Re: Limit softbody deformations
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.
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.