Add sewing seams to cloth simulation
Closed, ResolvedPublic

Description

Use loose edges marked as seams as sewing springs.
All this patch does is set the rest length to 0 and the stiffness to 1 for springs for loose edges marked as seams so that during the cloth simulation they will be brought together.

Example: http://www.youtube.com/watch?v=-Y_bC0gjoM0

Details

Type
Patch

Assigned to Daniel.

I don't think this feature can go in as is though. The seam flag on edges is for UV unwrapping, and we can't let that same flag influence cloth as well, it needs to be a separate thing. It would also break existing files with cloth simulation that have seams in them.

A simple solution might be an option that enables using all loose edges as sewing springs.

Made some modifications, it is now toggleable with a "Use Sewing Springs" checkbox and force control.
I've also added a vertex group and settings for shrinking the fabric.

I like how the patch progresses! Nice changes.

a) I could imagine a seperate tab where "preroll" and the sewing options can be put.
b) It would be nice if people wouldn't have to press alt-a to see the sewing effect. Maybe "preroll" and "sewing" can be somehow combined in a way that the sewing outcome is saved automatically as shapekeys. Do you know what i mean? :-) Using shapekey positions for the spring rest length was introduced during BBB production.

This work got quite the potential!

Hi Jez Kabanov,

Your patch is great! I merged your patch to my patch (cloth air pressure, #30941), and changed your code to allow negative shrinking factor (i.e. expanding the cloth).

I would like to spend some words for this patch, that is very useful, easy to use, robust, unobtrusive, and above all, it offers a more powerful approach to the making of garments or composed/patched items, similar to the Marvelous Designer concept (just the starting point...).

It would be nice, and harmless I guess, if it could be included in trunk.

Thank you,
paolo

codemanx added a subscriber: codemanx.

Merged with recent trunk and attached git-diff of patch version 1.2

Seems to work, any reason why it wasn't applied so far?

Daniel Genrich (genscher) closed this task as Resolved.Feb 6 2014, 7:04 PM

Commited, thanks people! Please test and tell me if there are any problems (with a blend file please!)

It looks like shrinking vertex group doesn't work, but there is already related code in patch file. It works if I leave the vertex group empty and change the Min and Max value, but nothing happens if the vertex group is not empty. Is it unimplemented or am I doing something wrong? This is test blend file in archive:

codemanx reopened this task as Open.Feb 9 2014, 11:29 PM

Re-opening as there are a few issues:

  • Vertex Group shrinking not working?
  • shrink_max not initialized with 1.0f (line lost during auto-merge?)
  • Possibly crashing for certain complex setups (no testcase yet, please try Mirror modifier, single loose edges as well as loose edge strings and change Collision settings during simulation)

thanks for the issue report codemanx, i'll see if i can fix those up.

Okay, I've figured out why it wasn't working.

I've uploaded a patch which fixes shrinking with vertex groups and readded initialising shrink_max.

the cloth_uses_vgroup function is rather odd and unclear about what it's doing and why.
I think it needs a good looking over to ensure it's doing what it's supposed to do.

"Possibly crashing for certain complex setups (no testcase yet, please try Mirror
modifier, single loose edges as well as loose edge strings and change Collision settings during simulation)"

Tested all these situations and was unable to crash it.

How do i install this addon to blender?

Hey,

I did take another look at the bugfix patch and looks not bad.

But I htink we need to introduce some checks if we are actually using SEWING mode: "if(clmd->sim_parms->flags & CLOTH_SIMSETTINGS_FLAG_SEW)" before checking the vertex groups: "if(clmd->sim_parms->vgroup_shrink > 0)".

My patch is not perfect, it could be that i "fixed" something which results in a bug. And I also know that there are some "if"'s missing to check for FLAG_SEWING.

Maybe you can help me getting this stuff production ready -

A note: "cloth_uses_vgroup"
"cloth_uses_vgroup" is used by the modifier stack to ensure that the necessary custom data layers are generated. In this case we need vertex group layers sometimes. It saves alot of time, if we don't request the custom data layers for vgroups if we don't use them. That's how every modifier does it :-)

@jesus lamas (jesus650rwc): It's not an addon. Get a recent build from buildbot or graphicall, it's integrated in those.

Thanks genscher for the explanation.

I'll fix up the SEW flag stuff.

One thing to note is that the sewing and shrinking functionality are not really related, it just so happens they're handy together for clothing design.

I might seperate them in the UI as you may want to just build a larger cloth mesh and shrink it over a collision model.

Hi genscher,

I added some missing if's for you, and fixing some bugs in your patch, and refined cloth_uses_vgroup() function.

As thesleepless said, maybe the sewing and shrinking functionality should be separated.

Is there a build for Mac OSX 64-bit with the sewing patch?

Luca Rood (LucaRood) closed this task as Resolved.Apr 19 2017, 6:11 PM

No idea why this stayed open so long...