Cloth simulator improvements

Most of the cloth improvements have been ported to Blender 2.8, and thus the cloth-improvements branch is no longer supported. It is strongly advised for anyone using cloth to switch to Blender 2.8. The status of the port and more details about the patches can be found here:


Note: Ever since I started working on my cloth proposal, all updates to my cloth developments have moved to my cloth page on the Blender wiki, and I’ll no longer update this post (apart from builds, whenever available). However, I’ll still continue answering comments in this thread.

Here is the latest win64 build, kindly provided by @Sim_Piko:
23-Jul-2018 build (7eb44c2):

==== Original post ====

Hey people,

Blender’s cloth simulator is quite nice, however recently I had the need for some features that weren’t available, so I decided to code them. After implementing the main things I wanted, I found myself getting increasingly familiar with Blender’s cloth sim code, so now I think I’m in a good position to continue adding a few more useful things.

I made this thread to post the status of my cloth developments, and to allow you guys to suggest some things you might want to see in the cloth simulator. Keep in mind that I’m doing this independently and in my spare time, so there is no guarantee that I’ll be able to implement everything, nor that it will be accepted into master if I do implement it. Also, I might dedicate more or less time to this, depending on the feedback I get here.

Here is a list of features, and their status (features are explained below):

[TABLE=“width: 500, align: left”]


Time multiplier

Dynamic base mesh

UI clean-up

Property scaling
Implemented for friction

Internal pressure

Better air resistance

Evaluating feasibility

Evaluating feasibility


  • Time multiplier:

This is a new property that allows you to change the “real world” speed of the simulation. This suppresses the problem that Blender’s cloth simulator has, of measuring time in frames instead of actual time, causing the simulation to seem much faster at higher frame-rates. With this new property, you can set the simulation to whatever speed you want. If it looks too fast, just decrease the time multiplier, and of course the opposite is also true. Also an additional thing that this feature allows, is to animate the speed, creating a “time warp” effect, demonstrated in the video below:

  • Dynamic base mesh:

This is a new checkbox that when checked, makes the cloth respect any deformation in the base mesh. So for instance, if you have a character that stretches, morphs, or changes proportions in any way, you can animate the cloth mesh accordingly, and simulate on top of the animation, and now your simulation will adjust and keep up with your animation (with dynamic base mesh checked, of course). This enables mainly the more extensive use of cloth simulations for cartoon animations in Blender, which couldn’t previously be simulated and would’ve had to be manually animated because of character “stretchyness”. Here is a little video demonstrating the effect:

  • UI clean-up:

This is fairly self-explanatory and isn’t really a feature, I have just made the cloth UI a bit more organized. This was in part because I had to fit the new features in, and partly because the UI was just a bit off, and could be improved upon. Basically what I did, was change things around a bit, to better align everything. Here is a side by side of, respectively, the old UI and the new UI with all the other features included:

  • Property scaling (Friction scaling already implemented D2166):

This is a feature similar to the existing stiffness scaling options, which allow you to set vertex groups to determine the bending and structural stiffness of the cloth. The plan here, is to implement vertex group based scaling of other properties, like mass or friction. I’ve not yet looked into the feasibility of implementing this, but I imagine it shouldn’t be too complicated. If nothing more important comes up, this is the next thing I’ll try to tackle.

You can test the features marked as “committed”, by downloading the latest daily build.

Well, I think that’s about it, I look forward to your feedback and suggestions :wink:

1 Like

Amazing. It’s about time a modifier gets some work done to it. The fluid simulator also needs some work.
I hope you have a MacOSX build available soon. And is the time multiplier keyframeable? For making slow motion effects.
I can’t wait to test this with my addon ClothFX.

multi-threading out of the question :slight_smile: ?

Great development. A feature I’d like to see is something like garment maker in 3ds max. It basically fills spline shape with triangles which deform better than quads using fewer polys. A second step would be dynamic tessellation like this on the fly only in places where it’s needed. Do you think it would be possible?

Very cool! Is there any compiled version with this patches applied? The best artistic feedback you’d get is from cloth artists, and they usually don’t know how to compile a “hello world”. Standard users usually can’t compile their own builds to test unless they are both artists and coders, of course. I’d try many interesting patches if there were compilations with them applied.

well maybe, have some option of disable stretching maybe at some edge lines.
you see with a woman torso, simple clothing deforms, and… dont know the word for it im not english, but around neck if you made a nice vshape one would like to keep it a v-shape, modern clothing is all about lines, and some lines you’d like to preserve more then others.

perhaps also some kind of a angle lock to keep such shapes, i find this the bigest problem with cloth sims.

maybe limits on endings on silk rippling (i hope thats english), so cloth wont twist too extreme.

Maybe some option that as in real life one wears a tuxedo suite, that you can point out where bends are likely to ocure (elbows, knees), but overall such clothing to appear straight.

Hey, nice to see some interest here :slight_smile:
Thanks for all your feedback.

To all those wanting builds, it isn’t worth it for me to provide them, as the changes I’ve made so far will be committed into Blender master really soon, thus you’ll be able to simply download one of the official buildbot builds, from here, with my changes included in a few days (As of now, the buildbot doesn’t include my changes yet, I’ll update this thread once everything is included). Also, if I was to provide a build, I could only do so for Linux.

@Albertofx, thanks. The fluid simulator is a whole different beast though, I’ll not be tackling that any time soon. Regarding the build, I wont be providing one, clarification in the paragraph above. And lastly, as I said in my original post, yes the time multiplier is keyframable, I even provided a video demonstrating that :stuck_out_tongue:

@cgstrive, unfortunately it is. Multi-threading is something I would really like to see too, but it is really difficult to implement for simulations, when it is even possible, thus it is way beyond the scope of what I can do. You can read a great explanation by lukas_t, of the issues of physics multi-threading here.

@cdog, the garment maker mesh generation is not really part of the simulation, it is more of a pre-simulation thing (totally different area of the code), and I’m currently working on the simulation code itself. However I don’t think it would be very hard to make a little addon to uniformly triangulate a mesh, probably using delaunay triangulation over a set of evenly distributed points on the mesh. If I have some time, I might look into that. Also, you probably already know this, but the other part of garment maker, where different planes are “sewn” together, is already possible in Blender, with sewing springs, see this.

@Strangerman, thanks for your interest, I won’t provide any builds, however. See the beginning of this post for clarification.

@Razorblade, I don’t quite understand your request about “silk rippling”, but all the other things you asked for, can already be achieved with stiffness scaling. That is a feature that allows you to use vertex groups to set a variable stiffness across the mesh, including bending stiffness, which is similar to the “angle lock” you said. There is a thread on stackexchange that talks specifically about the stiff collar case and explains how to do it, here, but the tuxedo case is just as easy to achieve. Also, for your collar thing, you might want to look into pinning too, as you can animate the positions of pinned vertices to follow your character animation.

I wonder is it possible to do the cloth behavior similar to marvelous designer? especially realtime sim and accuracy
At this moment Blender Cloth isn’t suitable for character animation except dummy-tests

And it would be nice to have a loop option for cycle animation

man, really great work, love what you’ve done with it.
going to test out soon.

What about adding a so-called Delauney generator (it’s a technology that remeshes an object into a net of random, but evenly sized triangles, which is then used to dramatically improve cloth sim quality)?

The method is also proven in production (developed by Disney for use in Frozen).

Any improvement in Blender physics and simulation is always well come.
Thank you very much!

Hey Luca.

Glad to see some additions to the cloth simming.

I had used Blender’s Cloth Sim for modeling toony character’s cloth. It’s no Marvelous designer, but works surprisingly well for toony stuff.
I’ve never tried Sewing Panels before today. Used your links to get a head start. Cool.

This is some “General Cloth” feedback from the tests I did today.

If you use the Playback option in the Timeline, than stop the sim at a certain point, find the frame you want to continue the sim from with some adjusted settings > after you hit playback (the second time), it seems fine, but after you stop - nothing has been stored in cache/memory (nothing from that second sim).

This really breaks the ability to fine tune the sims.

Something I know from before, same issue, if you sim something by using Play in the Timeline, after you stop and scrub - if you go past the last frame that was simmed and scrub back - you loose all simmed cache/memory.

I have a feeling this is the same issue. Any chance in fixing this?

Thanks on the work so far!

Hi Luca, great work! Does it only work on quads? Inserted an icosphere and noticed that it was doing nothing at all (scaled it in 5 frames from 0.2 to 1 and checked dynamic) … when I converted the triangles to quads everything worked as expected.

I played a little bit with dynamic mesh option in master.
I scaled down a falling drap to the size of a handkerchief using a shapekey with default cube as a collider.

The simulation bake was slowing down at the end of the animation due to faces of the mesh that became really small.
Did you think of a way to have an adaptative simulation that can handle this kind of scale changes avoïding too much computation ?

Edit: Forget about it. I have just realized that quality steps are animateable.

@Luca rood, perhaps you could try to help out Rich Colburn with getting his cloth stuff into blender:

Hey everyone, all my changes up to this point have been committed (thanks Campbell). This means the next buildbot build should include the new features (as of now the latest build was still done before everything was committed).

@cooler_inc, “behaviour like program x” is a bit vague. Also “real-time” and “accuracy” aren’t things you can just “add” to a piece of software, and are also extremely subjective. For instance you could say that Blender has real-time cloth simulation, the simulation time just depends on the mesh density and simulation quality. You could perhaps better phrase your request by asking for performance improvements, however that would be a grater endeavour than I currently have time for. As for accuracy, while the Blender cloth simulator isn’t totally physically accurate, you can get extremely visually appealing simulations if you spend some time tweaking it, and I would say the results can go far beyond “dummy-tests”. Now regarding looping, that is indeed an interesting idea. Despite there already being some limited and rudimentary techniques for cloth looping in Blender, I think this is something that would be nice to have integrated into the simulator itself, so I’ll look into it.

@Looch, thanks. As I said in the first paragraph, you’ll be able to test with the next buildbot build, I look forward to your feedback.

@Ace Dragon, I’ve already talked about using delaunay triangulation to generate cloth meshes (see my answer to cdog in my previous post). And as I said above, mesh generation is not really part of the cloth simulation itself, it’s more of a pre-simulation thing, and is a totally different area of the code than what I’m focusing on. Also, I think this kind of feature is better suited for an addon. However I’ll look into it anyway, as it is indeed useful, and there seems to be some interest around it. Also note that delauney triangulation is only actually better for simulations of nonwoven fabrics, while for the more traditional woven kind, it is better to have loops in the same directions of the weave (so usually quads).

@YAFU, glad you like it. I hope you test it out soon.

@0rAngE, thanks. And, with the new dynamic base mesh feature it should be even better for cartoons (That’s mainly what I added it for). About those issues you had, the first one is actually intended behaviour. The cache always checks if what it has stored is coherent with the current options, so if you change the cloth settings, the cache will become outdated and will want to update to agree with the current options. The only way to have changing settings, is by keyframing them, so that the cache can be stored with different options on different frames, without them being in disagreement at any point in time. Now the scrubbing issue does indeed seem to be a bug, however it seems to be a bug regarding the point cache’s interaction with the UI, and I don’t really have any experience in that area of the code, also, the point cache is being reworked for 2.8, so much will probably change in the coming months. Also, if you want to make a simulation permanent you should really get it baked, either by baking or by using the “current cache to bake” feature, after which you can scrub all you want without losing anything (If it really bothers you much, you can report a bug, as it doesn’t seem to have been reported yet, but I doubt anyone would fix this small issue, with 2.8 around the corner).

@plasmasolutions, thanks. And no, it works with any mesh. The issue you are having is regarding Blender’s distinction between a mesh and an object, you see, scaling an object has no effect on it’s mesh, so would also have no influence on the simulation. For the animation to have effect on the cloth simulation, you have to actually animate the mesh itself, by using shape keys, deformation modifiers (above the cloth modifier), or the animall addon. Now regarding your quad conversion, I have no idea what you did there, or what actually happened.

@zeauro, I’m glad you tested the new features. About the simulation slowing down significantly when getting small, do you have self-collision active? Otherwise, more than a minor slow-down shouldn’t happen.

@ZedDB, probably not, as there doesn’t seem to be anything to get into Blender. The link you gave seems to be just a video of a guy talking about some internal development in his company (I only watched the introduction), but I couldn’t find any code released by them. Also, this doesn’t give me much confidance in their project, with statements such as “The power of python and numpy for big data crunching”, as that makes it look like they want implement the simulation in Python, and though Python is indeed awesome, it’s performance is absolutely unacceptable for any respectable physics simulation engine (even with numpy).

That’s it for now, I hope to see some more feedback from you guys soon, when you can test the new features with the daily builds.

I also at first thought that it would be really bad when I heard that it used python+numpy. But if you take a look at the 26 minute mark you can see that he is able to simulate around 1500 tris in real time (60fps). I tried to make the same simulation with the code in blender master and I get around 6-8fps with a (probably) better CPU than he has in his laptop.

The reasion I asked you to take a look at it and see if you could help him out, is that all of his examples in the video provides a more robust and faster cloth sim than what is currenlty in blender. So it seems his python code somehow manages to out perform the blender C code.

He said that they were looking to contribute this code back to blender. But as you noticed no code drops has been done yet. In the youtube video comment section, he commented 3 weeks ago that he is still working on releasing it to the public, but he is occupied with other work related things.

Which is why I asked you for help. Maybe you can help him bring his code up to relasese quality or even port it to C.

For me, the cloth sim in blender has always been lacking because of stability problems and that it really slows down to a crawl with even quite low poly meshes. Seriously, take a look at the whole video. If this gets into blender, it could be really feasable to have charaters in blender that has simulated clothes on them for longer animations etc.

This might give some ideas towards that. The video shows my method for creating cloth starting with a plane. The Blend file starts with a spline and a couple modifiers. It does front and back together at this point.

Then must be converted to mesh to use. :frowning:

I eventually just used the “plane” method because I needed to convert the spline to mesh to actually sew, and then I could no longer edit it by spline handle. To much trouble to try and go back and forth.

Hopefully it’ll give someone who can code (not me!) an idea for something more automated.

And the Blend file with a spline base idea.

Just saying, 1500 tris at 60fps is really abysmal performance for 2016, not to mention Blenders existing performance that makes that seem good. Needless to say, basically all of Blender’s sim tools need some serious attention to even get close to industry standards for feature sets and speeds.

@ZedDB, I have now watched the entire video, and it does indeed seem quite nice, especially the volumetric collision stuff (collisions in Blender are currently pretty bad). But like I said, there isn’t much I can do regarding his implementation, until the code is released. And even then, I don’t think there will be much to be done, as it seems he intends to release a pretty complete/finished solution. Also, from his comments in the youtube video, it seems that it works as an addon, so nothing would actually have to be merged into Blender. Regarding porting to C, that would mean completely replacing Blender’s current simulator, and that is a huge undertaking, and way beyond what I can do in my spare time.

@rampa, what might give some ideas towards what? I am not sure “towards” what you’re referring, and I also am not quite sure what you’re describing. Are you talking about a garment maker kind of thing, like cdog asked about?

@m9105826, indeed simulations in Blender are not the fastest, however, I would disagree that 60fps is “abysmal” as we are talking about animation grade simulations and not game targeted ones. I was actually quite impressed by the video, considering it was supposedly done in python (plus it seems his frame-rate was capped ad 60fps, so who knows how fast it actually runs). Now regarding performance in the current simulator, I am afraid that goes beyond what I’ll able to improve there, however, I am dedicating some of my spare time to improve Blender’s cloth simulator feature wise (like you can see from the additions I already made), so if there are features you’re missing, please do share.

Note: All committed changes are now available in the daily builds (link in the first post). :slight_smile: