[Bf-committers] Some Maths / ideas / solutions for Softbodies.

frédéric van der essen fred at mentalwarp.com
Mon Nov 29 21:56:38 CET 2004


Hello !
I quickly looked into the softbodies code.
I'm not familiar at all with C++ and blender environment so i don't 
understand everything.
But i have some things that could interrest you.

Stability :
The stability is the main problem with cloth simulation so i have some 
tips to improve this.
1) We should either keep the system constraint based, or physic based, 
but not mix the two if it isn't necessary.
Ex : the system shouldn't be allowed to directly change the position 
/speed of the vertices after integration.
If we do that, we can forget all cool mathemathic theories that can help 
us to keep the system stable with euler explicit.
We can also forget about euler implicit method.
So all constraint (I think of hooks that could affect vertices, 
collisions,...) should be treated as forces, and Pixar's paper gives good
solutions to do this.
2) Euler explicit isn't the better way to integrate. If we keep the 
system totally physics based, then Implicit euler method could be 
implemented
and it is always stable. However it is a lot of hand calculus and it 
isn't flexible at all, we cannot add wind or others things without 
having to redo the maths.
If we use Euler explicit, there is a stability condition that can be 
evaluated and then we can adjust the step to keep the system stable.

let's state the euler explicit  solves : u'(x) =  f(x,u)  , u(0)  = x0, 
and we use Euler with a step 'h'
then : J(x,u(x)) (Jacobian matrix) = (in this case) df/du
the stability condition is :
h<-2/J(xu(x)) for every step. J has coefficent that will change each 
step, so we must réevaluate.
advantages : this is the only method to my knowledge to keep euler 
explicit stable in a precise way (but my knowledge is limited ;) )
disadventages : 
- this states that no exterior error has been added to the function 
between the steps. = no constraints.
- we must evaluate J (but its not as complicated as implicit euler )
We could however still use constraints and use a stricter condition, but 
it will crash for crazy user imputs.

I don't have the stability conditions for heun in my courses :(

We could use slower but better integration methods :
- Runge Kutta Fehlberg is an adaptive method. but it is really slow. 
(it's matlab ode23 and ode45) But it is precise and quite stable.

I will look for the perfect integration method after my exams.

3) Or, we could go for a totaly constraint based system :
since integration errors are due to high forces variations on the 
springs, we could use  small forces constants, but constraints to limit 
elongation.
It is well explained in this pdf,  
http://www.mentalwarp.com/~fred/divers/E02.pdf

4) I have read on many sources that the spring forces in clothes aren't 
linear, but more like square or exponential. Linear give way to much 
elasticity to the materials.
But it will not solve stability problems :(

5) Initial condition.
 : freeze the scene an only simulate the cloth until it reaches its 
equilibrium, then we use these values as initial conditions.
Since only the equilibrium is needed we can use faster integration 
methods, i will look how to do this.

Hope that it can help :)

-fred






More information about the Bf-committers mailing list