Blender cloth simulator air pressure enhancement

Hi everyone,

I have just added a simple air pressure feature to Blender cloth simulator, and spring length scaling factor, hope it will be useful for somebody :slight_smile: See screenshots:


And there is a YouTube video demostrates this feature (warning, a bit outdated):

but Iā€™m afraid that new users canā€™t post linkā€¦ Anyway, if you google ā€œblender cloth pressureā€ then you can find my video easilyā€¦

And there is a patch against svn r45571:

diff.zip (3.51 KB)

Finally I have a question: My code added a new property ā€œspring length scalingā€ to Cloth modifier, whose default value is 1.0. But when I open old blend files contain Cloth simulation, the property is loaded as 0.0, breaks the simulation :frowning: What should I do to let the program load the default value correctly if old blend file doesnā€™t contain this property?

2 Likes

readfile.c is where you want to look, probably in the ā€˜do versionsā€™ part.

Though what really should happen is the old files donā€™t break on loading but simulate how they did before you added these changes i.e. spring_length_scaling == 0 is the old behavior while spring_length_scaling > 0 is the new fancy stuff.

People get mad when a new change breaks all the work they did to get whatever they were working on ā€˜perfectā€™ā€¦

Oh, and you really should use the patch tracker on projects.blender.org once you get this nailed down because itā€™ll just get lost/ignored here.

----edit----

just watched the video ā€“ thatā€™s super coolā€¦

You could probably do a:

factor = foo * clmd->sim_parms->spring_length_scale ? clmd->sim_parms->spring_length_scale : 1.0f;

to just have it disabled when the factor is 0, not that I really understand if having a 0 spring length is valid or not. Or just use do_versions to set it to 1 on loading old files.

That looks terrific! I wish it will be in trunk soon!

Hi Uncle Entity,

Thanks for your advice, after checking ā€˜do_versionsā€™ function in readfile.c I think I shouldnā€™t change it now, instead I added check code in the simulator, only use spring_length_scale if itā€™s positive, otherwise 1.0 (default value) will be usedā€¦ And I have just submitted a patch on blender patch tracker (#30941).

That looks terrific! I wish it will be in trunk soon!

Thanks for your reply :slight_smile: Any new ideas and suggestions are welcomeā€¦

When the cloth collides with the plane, has no crinkles, crinkle control would be interesting
Thanks for your work

So apparently this will be in blender 2.81 :smiley:

https://developer.blender.org/T30941

1 Like

Sure took a while though! :smiley:

Now in master

Quick demo:

front left: cloth with air pressure
front right: cloth without air pressure
back: soft body (not carefully matched, just for rough comparison)

Videoā€™s short because the soft body sim took by far the longest, so I imagine cloth with pressure will be a satisfactory substitute under at least some circumstances for its time-saving benefits alone?

1 Like