soft body or fluid in the game engine

Hi,
I found several tutorials on tablecloth folding over an obstacle or water swashing through all kinds of containers. All these tutorials produce an animation by means of an intermediate bake file.

Does any single description exist, how to (for example) have some very simple cloth react on a cube which is interactively moved by the game engine? If this involves some python scripting, this is no problem. (More demanding, I am also interested in very-low-quality fluid simulation in the game engine).

As a simple workaround I modeled the cloth as 6x6 spheres interconnected by rigid body (ball) joints. This is working, but it is rather slow. I wish I could replace the lattice of spheres by blenders built-in softbody functionality.

Does such a thing exist in the game engine?

B.W.

some other external physics engine (havoc, ageia) has support for softbody for a while now, but blender does not have fluid/softbody support yet, as both function are extremely cpu intensive.

You might be able to fake something with a complex glsl script.

Of course, these tasks are cpu extensive.

But.
Firstly, I am prepared to adapt the resolution (number of softbody vertices or number of fluid LBM cells) to the available CPU performance, so that (at rather low resolution) you still have a few time steps per (real time) second, which could be interpolated to >30 fps even on average computing systems.
Secondly, the mathematical principles of the integration of physical, constrained, equations are - to my knowledge - the same in Ageia, Havoc and Blender. So there is no reason why Ageia should be significantly faster than Blender besides maybe a factor of 10 for optimization tricks.

All that is needed in Blender’s game engine, is to use the same softbody & fluid code that calculates the Blender animations. At sufficiently low resolution and with simplified collision detection nothing excludes these simulations from being done in the game engine.

Are there no attempts in this direction?

If a solution is available with other, free, libraries, I’d also be happy to read about them. But no closed source (Havoc, Ageia), please.

B.W.

If it is just a simple cloth, then I dont see why you cannot use bones for it? connecting several verts of the cloth to a bone…

then the plane will distort following the bone.

I probably dont understand. smile.

i am not saying it’s not possible. Yes the algorithms are well-established, and with today’s CPU, I think real-time softbody simulation of 10k-100k polygon is possible.

The reason why there is no attempt in this direction is simply because nobody is interested or competent enough to take on this task. Blender uses the bullet physics library, so any further improvement in the realtime physics department will probably take place there.

The ‘since xxx can do it, why can’t blender?’ argument has been heard many times, but one has to consider the work load of such an undertaking and the fact that Blender developers work for free.

the Blender game engine is rather oudated compare to those commercial behemoth
like UE3, so I don’t think adding adding cutting edge physics to the engine is top priority considering the renderer is almost entirely circa geforce-3 era.

I cant seem to figure that out! how do i attach verts to a bone/armature?

I dont see why you cannot use bones for it? connecting several verts of the cloth to a bone
Well, of course you can move 3D objects like (human) characters by moving the bones. Probably the same works for vertices of several faces (of a 2D cloth in 3D space). However, this would not obey the physical properties of the cloth!

The ‘since xxx can do it, why can’t blender?’ argument has been heard many times
My point is, that blender IS capable of these calculations. The algorithms ARE implemented for the animation.

but one has to consider the work load of such an undertaking and the fact that Blender developers work for free.
Sure. My question was, whether someone else did before, what I am trying to. Maybe somebody still gives a positive reply within the next days. Otherwise I’ll dig through the code and see if I can use the algorithms from the game engine.

You mention that blender uses Bullet Physics. This is indended for rigid bodies and collision detection. Therefore I don’t expect fluids and softbodies to be within Bullet’s objectives. I am also considering OpenTissue at the moment for softbodies, but it doesn’t include LBM fluid models (only smoothed particle hydrodynamics).

the Blender game engine is rather oudated compare to those commercial behemoth like UE3
So would you say that blender development focuses much more on movie animation than on games or physical simulation? Then what about the Apricot project? (Ehmm, just found that Apricot uses the Crystal Space engine instead of Bullet)

So my options are

  1. Find a way to use Nils Thuerey’s Blender fluid sim (http://graphics.ethz.ch/~thuereyn/ntoken3/Projects/Projects.html) and the corresponding softbody code (didn’t find references, yet) from the game engine
  2. Use OpenTissue for cloth and another library (which one?) for fluids
  3. check if Crystal Space provides both

Any suggestions which of these (or other) is most promising, are welcome. Or does somebody know the ideal - free - game engine with the answer to softbodies, fluids, and Everything? :slight_smile:

I cant seem to figure that out! how do i attach verts to a bone/armature?

Look at this: http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro/Bones
Vertices are attached to bones, if within the bone’s envelope.

Damned. Crystal Space provides neither fluids nor cloth, if I am not mistaken. Can some Crystal Space user give a hint, how they handle soft bodies?

I am currently learning to use crystalspace myself, though I don’t have an answer for you I can point you to where people do, #crystalspace on freenode. The devs are almost always there (particularly during euro daylight hours). They are very very helpful.