Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to design a robust cloth system. I have no problem at all simulating things like that using forward integration such as euler, midpoint, runge-kutta, verlet, etc. However, I just can't wrap my head around implicit methods.

I don't understand how you formulate the equations in linear algebra terms. I'd really like to see a VERY simple tutorial, and an actual example of how to construct the equations, and then solve for a very simple system (for example, 3 particles connected by 3 springs).

I looked into David Baraff's Large Steps in Cloth Simulation, and I can kind of follow it, but going from equations to code is a weak spot of mine.

I can use a package like eigen to solve, but I'd also really like to see some code for something like conjugate gradient descent. I don't care about efficiency at the moment, I just want to be able to clearly understand what's going on.


share|improve this question
I'm also interested in a detailed/step-by-step tutorial on how to properly implement more pretentious integrators. While I tampered a bit with the implicit Euler by solving a nonlinear equation using the Jacobian/Newton's method, it was not good enough. I then found OpenCloth (on google code). You can see the Exact code you requested here:… . It would be nice to also get a more tutorialish explanation with some figures "and stuff". – teodron Apr 16 '13 at 10:15
Fantastic! That's exactly the kind of thing I was looking for. I'm going to dig in right now, yummy! Cheers – DaleyPaley Apr 17 '13 at 1:50
It's worth mentioning that OpenCloth encompasses almost all major numerical integration methods for cloth-like objects. This piece of web deserves a lot more attention. I'll try to write a tutorial sometime in the near future (this year), as I also cannot find anything dealing with the implementation details for a not-so mathematical person. – teodron Apr 17 '13 at 6:40
@teodron: This was a good question, and seems to have been answered. Can one or both of you write up the answer, for the assistance of later members who visit this question? – Pieter Geerkens May 4 '13 at 20:12

So, as per Mr. Geerkens suggestion, for the sake of completeness, here is the answer to the question.

A fantastic example of cloth simulation using a variety of integration methods can be found here. It has explicit and implicit methods, IMEX, FEM, runge-kutta and verlet. It comes with complete source code that is easy to understand and easy to compare to other methods.

A fantastic resource that anyone interested in physical simulation should check out.

A tip of the hat to teodron for finding it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.