verletCloth01
I’ve wanted, for a long time, to implement a ‘verlet‘ integrated cloth sim. I’ve always thought the description sounded sophisticated and cool However, while I am on the ‘tech art’ side of professional video-game development and occasionally poke at code with a stick, I don’t have a strong traditional education in math or physics, other than what I learn on a ‘need to know’ basis. So it’s safe to say, I’m riding on the shoulders of giants here.
- You can download the zip of the Windows executable (32 bit) here.
- Unzip, and run verletCloth01.exe
- You can download the source Python module here.
When the sim starts, there is a cloth ‘grid’ suspended by its top left and right corners. On my 6 year old 32-bit P4 laptop, I’m getting around 16fps depending on the number of constraint loops (set to 2 by default – setting to 1 gets me over 20fps, but the sim gets really soupy).
Controls:
- Expects a 3-button mouse.
- You can LMB-click on any particle to make the particle stick to the mouse. LMB-click again, and the particle will stick in space.
- If you RMB on a stuck particle, it will unstick.
Resources:
When I first started web-searching for Python-related verlet integrators, I first found this blog post and source code by a poster called ‘domlebo’:
His blog referenced a 2001 Siggraph paper by Thomas Jakobsen, but it was a dead link. After some additional searching, I found a version here. I’ve also uploaded it to my site for prosperity here.
My code is a Python\Pygame interpretation of that 2001 Siggraph paper. Great learning experience. I did borrow some code inspiration from ‘domlebo’s source, it was a great starting point to understand the paper. But I’d like to think I put my own flavor on it and made it my own. At the time of authoring though, I honestly can’t say I get ‘everything’ that’s going on, but it was a fun two day project.
No comments yet.