← All ideas
  • Published 3 Mar 2019

softbody should have a "preserve volume" button

At the moment there is no good way to define in a soft body simulation that the volume of the mesh should not change. But this is very important if you want to simulate the deformation of elastic but non-compressible bodies under the influence of forces.

There are only crude workarounds, e.g. this one here:

Link

In my opinion, the problem is easy to solve. The volume of a closed mesh can be calculated very quickly and efficiently. Therefore, it would be simple to renormalize the volume after each soft body calculation step.

frame10.png

100%

Development Status: Open

Upvote 28 Downvote 0
stnkuehn
3 Mar 2019

21 Comments

stnkuehn Author

The feature is implemented.

These two videos

without "Maintain Volume"

with "Maintain Volume"

show a simulation with and without the new feature. As you can see, the animation with "Maintain Volume" switched on is much better.

Without the feature you have to set bending to a high value. The parameter punishes the deformation of the mesh. At the same time it leads to unrealistic effects and disturbances. With "Maintain Volume" switched on it is even possible to set bending completely to zero and one can achieve very nice realistic and organic effects.

Here is the patch: {attachment softbody_preserve_volumepatch}

2
Josephbburg

Thanks, hopefully this can find its way into master.

Vyach

* @stnkuehn * I agree with you: even if it will work nice for simple bodies like capsule, it can be simulated for capsule and then transmitted to general complex mesh as local deformation. Important thing, that it should be much simplier for user than molecular simulation, converting to mesh, shrinkwrapping, correcting etc…

stnkuehn Author

@all: At the moment the term "softbody" is somewhat misleading. It is rather something like a "soft hull". If you make the surface tension sufficiently strong or if you insert cross connections, then yes, you get an approximated softbody effect.

In the real world, however, the volume of elastic solids is always preserved. Is simply a law of nature.

At the moment the algorithm for the volume calculation works already. My plan is now to fill the softbody with a "virtual gas". If the volume is decreased by a calculation step, a virtual internal pressure occurs which leads to an outward force. On the other hand, if the volume is increased, the "virtual atmosphere" presses from the outside onto the softbody.

By default, the feature will be turned off. But it can be activated with a "Maintain Volume" constraint for this object. If someone has a better idea for the algorithm, please tell me.

Unfortunately, I don't have time to continue the work before the weekend.

1
redstonemaster4952

Is there any update to this for blender 3.x?

stnkuehn Author

If someone likes the feature, please help get the patch reviewed:

developer.blender.org/D4471

peter_boos_

Upvoted, reason most of the time current softbody fails in what i want to do with it. Its not realy clear to me how you do it, but it kind looks better. I kinda wonder can you simulate a half inflated baloon roling over a surface with it? your you tube example seams to pop back to original state quickly, is it possible for your math to do this for a percentage.

stnkuehn Author

* @Peter Boos *

Sorry for my late answer.

Yes, with "Preserve Volume" this can be done easily. See here:

Preserve Volume: 100, Bending 0.5

Preserve Volume: 0, Bending 0.5

Preserve Volume: 0, Bending 10

Here is the blender-file (2.8 with patch):

{attachment balloon}

LapisSea

YES! This is the exact option why I gave up on soft bodies in blender! It's just... So... Incomplete? Primitive?

Vyach

i think, it made this way just because it is much simplier to calculate surface edges as springs than forces inside volume. But for me it looks nice and volume preserving. may be it will fail with more complex situation. Can you show the difference?{attachment 160352jpg}

stnkuehn Author

* @ Vyacheslav * Here is an example:

{attachment frame0png} {attachment frame10png} {attachment frame20png}

I inserted a sphere and fixed one half with a vertex group. The animation works, but the volume is not preserved.

It would be nice if the "preserve volume constraint" would be respected.

2
Vyach

* @stnkuehn * it looks like you are not familiar with softbody settings at all. I made it first of my life after one tutirial. And all is okay. So stop request features until you learn how to work with.

red part is fixed (p.s. it is 2.8 may be physics better) {attachment 180347jpg}

stnkuehn Author

* @ Vyacheslav * Well, I don't want to argue, but what do you want to show? That with higher stiffness less deformation occurs? I deliberately chose the parameters to show the disadvantages.

Higher stiffness is not equivalent with softbody respecting the "preserve volume contraint". The advantage would be that the object can no longer collapse even with low spring strengths. Furthermore there would be no need to create artificial springs edges inside.

In short, the feature would simplify the work and provide better results.

1
Vyach

* @stnkuehn * ok, and what do you expect by object, that have very low stifness and volume preserving? What do you want to create? May be you need to use liquid with high viscosity? Unrealistic settings gives unrealistic results.

thiagocavalcantecarvalho

If you use the maintain volume constraint would not solve the situation?

Vyach

* @thiagocavalcantecarvalho * there is no difference with constrain. Also constrain is more for scale, than for full sim

1
stnkuehn Author

* @thiagocavalcantecarvalho * Unfortunately softbody ignores the preserve volume constraint.

1
stnkuehn Author

* @ Vyacheslav * I know. I looked into the code and I think I could add the feature. However, I don't know if the patch would be accepted.

Vyach

* @stnkuehn * so add, compile and show. If it will work stable, it will be accepted for sure.

thiagocavalcantecarvalho

* @thiagocavalcantecarvalho * In fact, this volume-preserving bid should work on a great deal of things. For example, the current sculpt mode for grease pencil. This would be perfect for squash and stretch.

1
Vyach

* @thiagocavalcantecarvalho * I agree, that is volume preserving is important, but in this certain case it already works nice enough.