Simulation of inextensible cloth

Please don't post Bullet support questions here, use the above forums instead.
Jan Bender
Posts: 111
Joined: Fri Sep 08, 2006 1:26 pm
Location: Germany

Simulation of inextensible cloth

Post by Jan Bender »

Hi,

I am just working on a simulation method for inextensible cloth:

http://www.impulse-based.de/index.php?o ... 2&Itemid=9

The cloth is simulated with a maximal allowed strain in order to provide a realistic simulation of (almost) inextensible cloth. The cloth is simulated by a mesh of particles linked by distance constraints. The problem is the mesh of the cloth. A triangle mesh cannot be used since the simulation of inextensible cloth would result in a totally stiff piece of cloth. When using a quad mesh, the problem is that the area of a quad changes during the simulation and can even be zero. Does anybody know a good solution for this problem?

Thanks,

Jan
Erin Catto
Posts: 316
Joined: Fri Jul 01, 2005 5:29 am
Location: Irvine

Re: Simulation of inextensible cloth

Post by Erin Catto »

Real cloth is not inextensible, so why should the simulation be inextensible?

I would only use an inextensible model/solver if it leads to a computational advantage. In this case it appears that there is a disadvantage.
colinvella
Posts: 24
Joined: Sat Feb 09, 2008 2:38 pm
Location: Malta

Re: Simulation of inextensible cloth

Post by colinvella »

My gut feeling is that a triangular or quad mesh with perfectly rigid distance constraints will end up bending only along the edges, corresponding to the tri or quad edges, provided that the elements are regular such that collinear edges may be found along the cardinal tri or quad edge directions. The constraints would have to give way to allow bending along arbitrary directions and you would also need to accommodate situations like crumpling which clearly alter the perceived area of the cloth.
Jan Bender
Posts: 111
Joined: Fri Sep 08, 2006 1:26 pm
Location: Germany

Re: Simulation of inextensible cloth

Post by Jan Bender »

Erin: There exist many types of textiles that are almost inextensible. This is the goal of my work. Take a look in the following Siggraph paper, if you want to know more about "why simulating inextensible cloth":

"Efficient Simulation of Inextensible Cloth"
http://www.cs.columbia.edu/cg/ESIC/esic.html


Jan
batty
Posts: 1
Joined: Wed Oct 01, 2008 10:43 pm

Re: Simulation of inextensible cloth

Post by batty »

You might also want to take a look at this paper from SIGGRAPH 2008
http://www.cs.ubc.ca/~rbridson/docs/eng ... -cloth.pdf
They tackle the same problem, but with a method that allows triangle meshes to be used, without stretching.
Jan Bender
Posts: 111
Joined: Fri Sep 08, 2006 1:26 pm
Location: Germany

Re: Simulation of inextensible cloth

Post by Jan Bender »

Batty, thanks for the hint. The paper looks interesting.

Jan
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Simulation of inextensible cloth

Post by Erwin Coumans »

Hi Jan,

Haven't read your paper yet, but can you explain:
  • What constraints do you solve? Just position/distance constraints, or also velocity constraints?
  • How many iterations do you use? A fixed amount, or do you terminate once the constraint error falls below a threshold?
  • Do you add additional 'bending' constraints?
  • Can you provide some pictures on the topology of your cloth mesh?
I'm curious how your impulse based cloth solution compares to the one available in Bullet. Haven't looked into the cloth/soft body contribution by Nathanael in details yet, so I try to provide some information on the method used in Bullet.

Thanks,
Erwin
Jan Bender
Posts: 111
Joined: Fri Sep 08, 2006 1:26 pm
Location: Germany

Re: Simulation of inextensible cloth

Post by Jan Bender »

Hi Erwin,
What constraints do you solve? Just position/distance constraints, or also velocity constraints?
For each distance constraint a velocity constraint is also defined. For performance reasons it is possible to ignore them completely. Even if you ignore them, you will can good results.
How many iterations do you use? A fixed amount, or do you terminate once the constraint error falls below a threshold?
If you want to guarantee a certain maximal strain, then you have to iterate until the constraint error falls below a certain threshold. And if you want to guarantee a maximal computation time per simulation step you have to use a fixed amount of iteration steps.

In november I will present a paper at the VRIPHYS conference containing a method that reduces the amount of required iterations by subividing the model in independent parts. This method even allows a parallel simulation. In future I want to spend a bit more time on parallel simulation, since it is very interesting in times of multi-core systems.
Do you add additional 'bending' constraints?
Not yet.
Can you provide some pictures on the topology of your cloth mesh?
It is a very simple regular grid. So a 3x3 coth mesh will look like this (x = particle; -,| = distance joint):

x-x-x
| | |
x-x-x
| | |
x-x-x

Btw. nice Maya-Plugin. We are also working on a plugin for Maya at the moment.

Cheers,

Jan
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Simulation of inextensible cloth

Post by Erwin Coumans »

Jan Bender wrote: For each distance constraint a velocity constraint is also defined. For performance reasons it is possible to ignore them completely. Even if you ignore them, you will can good results.
Indeed. The soft bodies / cloth in Bullet has configurable set of solvers, and the demos use position based solving by default.

1) for soft bodies linear constraints+basic contacts you can look at btSoftBody::setSolver that where solvers sequence is setup, you can change it or add presets, here is a short description:
- predict motion (ie q=x , x=x+v*dt)
- for each velocity solver in btSoftBody::m_vsequence DO solve THEN x=q+v*dt
- for each position solver in btSoftBody::m_psequence DO solve THEN v=(x-q)/dt
- for each drift solver in btSoftBody::m_dsequence, DO q=x THEN solve THEN v=v+((x-q)/dt)*kVCF

All demos use eSolverPresets::Positions (meaning classic verlet like solver, empty vsequence and dsequence).

In think eSolverPresets::Velocities should behave more or less like your (Jan Bender) method. Not sure if we understood your paper, but I think you are solving for positions in the future (using x+v*dt instead of x) which is ok since you don't propagate position correction to velocities.

2) rigid/soft & soft/soft joints and cluster contacts are solved by a simple sequential impulse solver, (see btSoftBody::solveClusters,btSoftBody::LJoint and btSoftBody::AJoint).

So, there are currently 3 different soft body solvers, for positions, velocities, and joints.
Btw. nice Maya-Plugin. We are also working on a plugin for Maya at the moment.
Will you also make it available, with source code under the Zlib? If so, we could share/collaborate easier.

Thanks,
Erwin
Jan Bender
Posts: 111
Joined: Fri Sep 08, 2006 1:26 pm
Location: Germany

Re: Simulation of inextensible cloth

Post by Jan Bender »

Hi,
In think eSolverPresets::Velocities should behave more or less like your (Jan Bender) method. Not sure if we understood your paper, but I think you are solving for positions in the future (using x+v*dt instead of x) which is ok since you don't propagate position correction to velocities.
For solving the position constraints I do a preview to get the position error in the future. Knowing this error I can determine how the relative velocity of the particles/bodies must change now to prevent them from drifting apart. At the end I compute a corresponding impulse and apply it to the particles/bodies.

The velocity constraints are resolved at the end of each simulation step. So this will not influence the correction of the position constraints.
Will you also make it available, with source code under the Zlib? If so, we could share/collaborate easier.
I must talk with the guy who implements it. But I think we will publish it as open source.

Jan