Animated Dynamic Clothing Technique (proof of concept)

stringtheory9stringtheory9 Posts: 411
edited December 2014 in Carrara Discussion

After months and months of experimenting and trying to come up with a workable solution I think I have finally come across a technique that interfaces the keyframe environment to the physics cloth environment in a usable way. Now it just needs to be refined.

I have not spent very much time on this yet but thought it would be good to post it here and we can use this thread to experiment and share our findings with the community.

This process involved creating a double layered mesh with an inner shell that fits over the character like a body-suite. The body suite mesh is then separated at the bone joints so that each major bone section has its own separate exo-shell. For my POC I just took the V4 body suite mesh and chopped it up but I think a custom made low poly mesh would be more effective (I'll work on one of these as time permits). Each of the different inner mesh sections needs to be given a vertex name.

The next step is to add the outer mesh which is the actual cloth that will be seen and animated. Both the inner and outer meshes need to be in the same vertex object. I am thinking that once we have a working inner mesh structure template it would be simple to open that template and simply copy and paste the outfit into the vertex object.

To make it all work a soft body modifier is added to the vertex object and the inner mesh sections are then each individually "soft body attached" to the corresponding bone section of the character. This is done by adding multiple "soft body attach" modifiers and then using the "Named Vertices" button to pick the correct set of vertices (see image below). One note of caution is that multiple shading domains seem to interfere with the named vertices when it comes to selecting the vertices for attachment.

Since we are simulating a soft body (inner mesh) against a soft body (outer mesh) the simulation speed is really fast. It takes under a minute to simulate a second of cloth on my 1.6 Ghz Intel Core i5 Air book.

Self collation must be checked and I have found it beneficial to uncheck the "Collide with other Objects" checkbox of the underlying character as the interaction between the cloth and the movement takes place through the soft body attach modifiers. This cuts down on the physics calculations required.

This video shows a fast moving arm with lots of jerky movements and no mesh ripping. This simulation took 3 minutes to calculate.
Animated Dynamic Cloth POC

clothpoc.png
762 x 648 - 211K
Post edited by stringtheory9 on
«13456717

Comments

  • DiomedeDiomede Posts: 15,171
    edited December 1969

    Thanks for posting. Looks promising. When I get everything re-installed, I will make a few tests. I had tried playing with the substance settings (eg., clay) but the soft body simulations took so long that I preferred to use Poser, so stopped experimenting.

  • DUDUDUDU Posts: 1,945
    edited December 2014

    PhillW already made a success of this attempt, I don't find anymore the thread on the forum, but here the results of he's research: https://www.youtube.com/watch?v=8J330vCj1io
    For me also that was an obsession for a long time but I ended up adopting the solution to make my simulations in Poser and to import them in Carrara (like Diomede).
    Here two of my tests with two different techniques:
    https://www.youtube.com/watch?v=ptHEd-wIDLM&list=UU2ad-B9kftJzKv_0HyekV3g
    and
    https://www.youtube.com/watch?v=98_6Hsh7ts8&list=UU2ad-B9kftJzKv_0HyekV3g&index=4
    Your solution doesn't seem simple but is worth to be tried thoroughly…

    Post edited by DUDU on
  • JonstarkJonstark Posts: 2,738
    edited December 1969

    Nifty idea, Stringtheory! Very interesting concept, and I'm interested in seeing where it goes.

  • Hermit CrabHermit Crab Posts: 841
    edited December 1969

    As soon as I read this thread earlier this evening, I tried out the concept (having also spent months trying out many hundreds of simulations at the beginning of this year).

    I first made a cylinder with two soft-body attach zones and attached these to the main arm bones (of one arm). During the simulation the cloth moved as if rigged without any weight painting when the arm moved. Excellent.

    I didn't go on to copy a sleeve like yours but made a 'dress' out of a plane of quads. I brought down (extruded) some of the faces near the middle of this plane to make two 'thighs' - actually they had square cross-sections. Square Pants if you will:-)

    The thighs were soft-body attached to each of the figures thighs and the flat plane draped over them during the simulation. The great news is that, when the legs moved, they didn't pass through the dress. Neither did they tangle it up.

    This looks to be a discovery with a lot of potential.

  • Hermit CrabHermit Crab Posts: 841
    edited December 2014

    OK, I'll show my pathetic work which was done in great haste to try out the concept.

    DocA.jpg
    640 x 480 - 31K
    Post edited by Hermit Crab on
  • WendyLuvsCatzWendyLuvsCatz Posts: 38,223
    edited December 1969

    I have done very simple dynamic softbody sims using vertex objects keyframed to follow my figures
    I found parenting or attaching them via animation atatch skeleton tended to lose the collision effect
    mind you that was C8.1 C8.5 may be worth retrying
    I also found hair sims work better if done on a head shoulder object that follows the figure without being attached and the figure removed or hidden for sim.

  • Hermit CrabHermit Crab Posts: 841
    edited December 1969

    Oops - managed to submit that before I was finished...

    DocD.jpg
    640 x 480 - 13K
    DocC.jpg
    640 x 480 - 13K
    DocB.jpg
    640 x 480 - 13K
  • Hermit CrabHermit Crab Posts: 841
    edited December 1969

    Hi Wendy,

    In my past experiments I tried everything I could think of but the OP's idea is completely new to me.

    I tried attaching elongated spheres to limbs but the cloth's weight would dislodge them or get tangled on to them. Actually I found a method of avoiding that but it's altogether too convoluted to be worth explaining.

    I tried having soft-body cloth parented by boned objects but that failed.

    But the technique shown in this thread looks to be workable - although the clothes creation aspect won't be trivial.

    BTW I learn a great deal from what you show and from your replies to others - lots of thanks.

  • PhilWPhilW Posts: 5,145
    edited December 1969

    Stringtheory - nice idea, if I get some time I will give it a try. My own experiments made some progress but it wasn't too reliable. These days if I need dynamic cloth, I export an MDD file of the animation into Marvelous Designer 2 (I am still on version 2 as I didn't like their new subscription payment model), run the cloth simulation there and then re-import that back into Carrara. But I really wish that it would be fixed so that we can do it direct in Carrara, after all Poser has had that for over 10 years!

  • JoeMamma2000JoeMamma2000 Posts: 2,615
    edited December 1969

    stringtheory9, I'm not sure I understand the point of your technique. Maybe my brain is out of gear more than normal today, but I can't see the overall purpose of this method.

    The way it stands now, Carrara doesn't calculate collisions with moving objects, so any dynamic clothing technique with animated objects ain't gonna work, unless I missed a Carrara update to the dynamics simulation.

    What am I missing? Thanks.

  • DiomedeDiomede Posts: 15,171
    edited December 2014

    Great discussion. I am still reloading programs and content, but I did get a chance to do one test of a skirt using Aiko3. I think there is a lot of potential, even though my soft-body attached part didn't quite work the way I intended. I only did the one test, but I think more experimenting will discover situations in which this will work very well (I anticipate continued problems with things like furniture, but one problem at a time). This method focuses on two soft body physics functions that seem to work pretty well, and ignores one that doesn't.

    If I understand, SELF-collision seems to work pretty well and work relatively quickly. And, the softbody attach function works pretty well. That is why attaching a flag to a flag pole seems OK. So, the idea is to create cloth models in which the interaction would be based on SELF-collision and the movement would be based on soft-body attach. Any issue related to collision with other objects is bypassed.

    To implement, the suggestion is to have a base bodysuit with named vertices corresponding to the bones (the soft body attached part) and then in the same model create the clothing (the self-collision part).

    I'll post results using Aiko3 when I get a chance, but it probably won't be until the weekend. Like Dudu, I still use Poser's cloth room and import if I want to have a drape, but I see a lot of potential for this technique in some situations. Once a base bodysuit with named parts is created for a given character, it would not be difficult to generate cloth items. Furntiure interaction and shading would still be issues, though.

    Great job, Stringtheory. I admire your persistence. I had given up. Time to go back in the laboratory. Bwahahahaha!

    Edit: And Marcus, thanks for posting your screenshots. Gives me more ideas.

    Post edited by Diomede on
  • DUDUDUDU Posts: 1,945
    edited December 2014

    Personally, I believe that we must await a next true version of Carrara to have good simulations of clothing.
    For simple cloths, C8 works very well, but when it's a question of applying that to a character high-resolution, it's another story.
    @ PhilW: I made many tests in MD, and I also learned how to create simple clothing, but I never found the manner of importing in a reliable way simulations into Carrara.
    I tried to import/export in Collada, but that doesn't work at all, for me, the only possible result is to import a .bvh into MD and export in .obj seq. (DCG importer for Carrara).
    Can you explain the process you uses ?
    Thanks a lot !

    Post edited by DUDU on
  • WendyLuvsCatzWendyLuvsCatz Posts: 38,223
    edited December 2014

    nevermind

    Post edited by WendyLuvsCatz on
  • Hermit CrabHermit Crab Posts: 841
    edited December 1969

    Just a quick post or two before I need to go out.

    Today I had a couple of hours to test this further. I know that I haven't tried to use a body suit for cladding the avatar but I tried making something a bit more refined than yesterday's effort. (That was a beer-mat sketch kind of thing).

    Here is the garment I used for a few trials.

    It is made of three parts which aren't attached in any way but they were grouped in Hexagon to make one object.

    I'm using V4

    2014-12-16_183021.jpg
    638 x 595 - 39K
    2014-12-16_183221.jpg
    638 x 595 - 106K
  • PhilWPhilW Posts: 5,145
    edited December 1969

    Personally, I believe that we must await a next true version of Carrara to have good simulations of clothing.
    For simple cloths, C8 works very well, but when it's a question of applying that to a character high-resolution, it's another story.
    @ PhilW: I made many tests in MD, and I also learned how to create simple clothing, but I never found the manner of importing in a reliable way simulations into Carrara.
    I tried to import/export in Collada, but that doesn't work at all, for me, the only possible result is to import a .bvh into MD and export in .obj seq. (DCG importer for Carrara).
    Can you explain the process you uses ?
    Thanks a lot !

    Sure - I set up the animation in Carrara, starting with a default position which was used to model the clothing initially (I often use an A-pose rather than the usual T-pose for this as I think the shoulders sit better. Have a look at a typical jacket for example and the arms are half down, not out to the side). Export this as an MDD file using Fenric's MDD exporter plugin - confusingly MDD has nothing to do with Marvelous Designer (often shortened to MD just to add to the confusion!), it is a file format that exports the mesh and then how each point on the mesh moves for each frame.

    Marvelous Designer can import the MDD file in the same way as loading an OBJ to use as the avatar, but just that it is animated. Assuming you have your clothing set up, when you import the MDD file it will run the simulation as it steps forward each frame. You can then save out the animated clothing as another MDD file. For both the import and export use the Inches scaling preset to convert units between Marvelous Designer and Carrara.

    Back in Carrara, import the MDD clothing file into your original animated scene. If you disable the Auto-position and check "Disable Auto-Scaling" the it should load exactly in the right position to match the animated character which you exported.

    I hope that helps.

  • Hermit CrabHermit Crab Posts: 841
    edited December 1969

    Here are some results from simulations.

    I tried many settings and kept collision of V4 on - so that the upper half would have something to drape against.

    With each simulation I had poke-through, unfortunately.

    I shortened the dress when I found that the overlapping hem was getting caught up in the figure's knees. But there was still poke-through.

    Perhaps (being optimistic) if a way could be used to make the inner meshes invisible, then the figure's legs may not poke-through. But still the cloth hem has suffered from being tangled.

    There isn't any doubt that moving objects pass through soft-body cloth during a simulation.

    The hope here is that the parts of the mesh being moved (by the influence of the bone it is soft-body-attached to) will self-collide with the remainder of the mesh.

    I'll decide later whether to try further but hope that I haven't hindered anyone else with my approach.

    4.jpg
    549 x 557 - 45K
    3.jpg
    549 x 557 - 43K
    2.jpg
    549 x 557 - 42K
    1.jpg
    549 x 557 - 39K
  • Hermit CrabHermit Crab Posts: 841
    edited December 1969

    I should add that the inner mesh which was colliding with the hem in the previous illustrations was created in Hexagon by duplicating the mesh on the other side.

    I believe that has given it reversed normals. I gathered that from looking at the model in a 3d viewer.

    Now, in saying that I'm at the far outer limits of my knowledge level - and I'm already well out of my depth. But it may be something for those who know more about these things. Perhaps it has a bearing on the simulations.

    Must go, folks.

    Regards to all.

  • DUDUDUDU Posts: 1,945
    edited December 1969

    PhilW said:
    Personally, I believe that we must await a next true version of Carrara to have good simulations of clothing.
    For simple cloths, C8 works very well, but when it's a question of applying that to a character high-resolution, it's another story.
    @ PhilW: I made many tests in MD, and I also learned how to create simple clothing, but I never found the manner of importing in a reliable way simulations into Carrara.
    I tried to import/export in Collada, but that doesn't work at all, for me, the only possible result is to import a .bvh into MD and export in .obj seq. (DCG importer for Carrara).
    Can you explain the process you uses ?
    Thanks a lot !

    Sure - I set up the animation in Carrara, starting with a default position which was used to model the clothing initially (I often use an A-pose rather than the usual T-pose for this as I think the shoulders sit better. Have a look at a typical jacket for example and the arms are half down, not out to the side). Export this as an MDD file using Fenric's MDD exporter plugin - confusingly MDD has nothing to do with Marvelous Designer (often shortened to MD just to add to the confusion!), it is a file format that exports the mesh and then how each point on the mesh moves for each frame.

    Marvelous Designer can import the MDD file in the same way as loading an OBJ to use as the avatar, but just that it is animated. Assuming you have your clothing set up, when you import the MDD file it will run the simulation as it steps forward each frame. You can then save out the animated clothing as another MDD file. For both the import and export use the Inches scaling preset to convert units between Marvelous Designer and Carrara.

    Back in Carrara, import the MDD clothing file into your original animated scene. If you disable the Auto-position and check "Disable Auto-Scaling" the it should load exactly in the right position to match the animated character which you exported.

    I hope that helps.

    Thanks for your answer with explanations.
    Thus, it is the Fenric's plugin the solution !
    It's a pity that one cannot download it for tests because I'm very interested.
    If I can use this plugin, I can wait a long time for C9...
    In Realflow, there is a format of export " .md" (Mesh seq), is it the same thing ?

  • PhilWPhilW Posts: 5,145
    edited December 1969

    "In Realflow, there is a format of export ” .md” (Mesh seq), is it the same thing ?" - I would be 99% certain that it is the same, as the description "Mesh Sequence" is pretty well what it is, and I Googled it and it looks like Realflow exports to MDD. The main limitation with MDD is that the topology needs to be the same throughout the animation - that is, the same points are connected in the same way - they can move and distort all they want but the structure of the mesh stays the same. This will be true for some water sims but not all.

  • stringtheory9stringtheory9 Posts: 411
    edited December 2014

    I should add that the inner mesh which was colliding with the hem in the previous illustrations was created in Hexagon by duplicating the mesh on the other side.

    I believe that has given it reversed normals. I gathered that from looking at the model in a 3d viewer.

    Now, in saying that I'm at the far outer limits of my knowledge level - and I'm already well out of my depth. But it may be something for those who know more about these things. Perhaps it has a bearing on the simulations.

    Must go, folks.

    Regards to all.


    Marcus Severus,

    Nice work. Make sure you have friction and bounce turned down to 1% on both the cloth and the character.

    I have made more progress and posted the results in this video:
    Skirt Video

    I'm out of time for tonight (have to get up for work in 5 hours). I will upload the settings used in the video tomorrow night.

    Edit: I decided to get less sleep.
    The image below shows the "cloth" grid that I am using to cage the upper thighs and the skirt (a cone with the top chopped off) has been dragged to the right to reveal the grid.
    The animation in the video has the collision turned off for V4.

    A soft body attach band around the top of the skirt and the grids on the thighs are the only forces (besides gravity and inertia) acting on the skirt. The calves can be seen going through the skirt when she turns as the shin cloth grids have been deleted for this example. With the character collision turned off the 9 second render in the video took only 4.5 minutes to simulate!

    Quick tip: If you nest the cloth object inside the avatar you can then export (as a car file) the avatar, import it back in and the dynamic cloth will be baked. You can then delete the inner mesh, turn on collision for the avatar and add hair and conforming clothing that will not interfere with the dynamic cloth.

    clothgrid.png
    864 x 585 - 169K
    Post edited by stringtheory9 on
  • stringtheory9stringtheory9 Posts: 411
    edited December 1969

    PhilW said:
    Stringtheory - nice idea, if I get some time I will give it a try. My own experiments made some progress but it wasn't too reliable. These days if I need dynamic cloth, I export an MDD file of the animation into Marvelous Designer 2 (I am still on version 2 as I didn't like their new subscription payment model), run the cloth simulation there and then re-import that back into Carrara. But I really wish that it would be fixed so that we can do it direct in Carrara, after all Poser has had that for over 10 years!

    Hi PhilW,

    Thanks. Much of where I am at right now is thanks to the excellent tutorials that you have published. I have toyed with the idea of pulling the animated objects into another program, such as MD, but I keep coming back to "I've got to get it working natively". My goal is to produce a 90 minute movie so I really need to keep my pipeline as simple as possible. I think I've tried 10 completely different ways to get soft cloth working reliable and in a way that doesn't take forever to simulate. Using an inner mesh as a buffer is the closest I've come. If this doesn't work out ill be reading up on your Marvelous Designer techniques.

  • PhilWPhilW Posts: 5,145
    edited December 2014

    I am trying your method - at first I was having an issue with naming, then realised that I had to name the Vertices and not the polymesh or the polygons. But now when I try to allocate multiple Soft Body Attach areas, I can only appear to edit the attached vertices in the first one on the list, trying to add the named vertices on a subsequent one just changes it on the first one instead! Is that just me, or did you find a way around that?

    Edit - It's OK, I have it now - you need to select each Soft Body Attach when in the vertex editor and you can then go through and assign each area in one sweep, quite an efficient way to do it now I know how!

    Post edited by PhilW on
  • FenricFenric Posts: 351
    edited December 1969

    Thanks for your answer with explanations.
    Thus, it is the Fenric's plugin the solution !
    It's a pity that one cannot download it for tests because I'm very interested.
    If I can use this plugin, I can wait a long time for C9...
    In Realflow, there is a format of export " .md" (Mesh seq), is it the same thing ?

    Just ask. I can make a trial version that does a limited number of frames pretty quickly.

  • JonstarkJonstark Posts: 2,738
    edited December 2014

    Holy cow Stringtheory, that skirt video is freaking impressive, just at a glance I'd say you've solved it, that looks and behaves like dynamic cloth should to me. Well done!

    Post edited by Jonstark on
  • stringtheory9stringtheory9 Posts: 411
    edited December 2014

    PhilW said:
    I am trying your method - at first I was having an issue with naming, then realised that I had to name the Vertices and not the polymesh or the polygons. But now when I try to allocate multiple Soft Body Attach areas, I can only appear to edit the attached vertices in the first one on the list, trying to add the named vertices on a subsequent one just changes it on the first one instead! Is that just me, or did you find a way around that?

    Edit - It's OK, I have it now - you need to select each Soft Body Attach when in the vertex editor and you can then go through and assign each area in one sweep, quite an efficient way to do it now I know how!

    It took me a quite a few go rounds to realize it was an efficiency feature and not a bug. To other readers; when selecting (making active) different modifiers in the soft body attach room, if you click the ball with the check mark indicating you're done, and then select a different soft body attach modifier the first one on the list becomes the active modifier and not the one you just clicked on. However, if you don't verify your selection you can go throug each modifier by clicking on it, make your selection and then click on verify at the end. This is the efficient way to do it.

    Also, I may have mislead earlier with my comment that bounce needs to be set to 1%. I can't test it right now but my last simulation was run with bounce set to 50% and this was the one that had zero poke through. It only occurred to me after I shut down for the night that the bounce setting might play an important roll in moving (bouncing) the cloth a little further away from the oncoming mesh so that the next movement doesn't break through. I will experiment the next chance I get and post my findings.
    Update: The bounce setting did not seem to make any difference.

    Post edited by stringtheory9 on
  • PhilWPhilW Posts: 5,145
    edited December 1969

    I have done some tests and it is certainly looking promising. The big issue I seem to have now is that the cloth animation is showing in the assemble room, but when I render, the cloth stays in its frame 0 position throughout. Two steps forward and one step back (but that is making progress!). I have spent far too long on this when I should be focusing on other things, maybe I will get more time over the Christmas break.

  • stringtheory9stringtheory9 Posts: 411
    edited December 2014

    Jonstark said:
    Holy cow Stringtheory, that skirt video is freaking impressive, just at a glance I'd say you've solved it, that looks and behaves like dynamic cloth should to me. Well done!

    Thanks Jonstark. It may not work for an epic ninja battle scene but so far I'm feeling very hopeful that I can use it for my fairly placid scenes :-)

    Marcus Severus, make sure that your scene simulation accuracy is set to between 250 and 300% and the geometric fidility is set to 100%. This should eliminate the poke through and the snagging and it does not add too much extra time to running the simulation.

    Post edited by stringtheory9 on
  • Hermit CrabHermit Crab Posts: 841
    edited December 2014

    Hi stringtheory9,

    In earlier posts I forgot to say how impressed I am by your insight.

    Your video is impressive and looks like you might have cracked it. I tried making a one-piece cloth today but still had poke-through with the settings I was trying. I was finding that the soft-body attach areas acted like solids and were passing through - much like as I showed in the pictures yesterday.

    Here is today's mesh. I made a second version with the skirt more like a cone but neither worked perfectly.

    When I first began posting in the forums here, at the beginning of this year, I began a thread called 'Trying out physics in Carrara' and posted links to some abysmal videos I put on to youtube.

    I was fairly inexperience in Carrara and knew nothing about physics. So not only was it a tedious, long-drawn-out failure my posts were tedious long-drawn-out affairs also.:-) With errors and misunderstandings along the way. But since you have wrestled with the same issues, perhaps you would find some interest in it. (The forum members were very kind in assisting me but knew I was flogging a dead horse, I think!)

    Regards

    Phil, Dudu - sorry I crossed your most interesting discussion - I was posting yesterday at the same time.

    EDIT - I said above I knew nothing about Physics - I meant Physics in Carrara

    WIP2.jpg
    753 x 602 - 31K
    WIP.jpg
    753 x 602 - 27K
    Post edited by Hermit Crab on
  • stringtheory9stringtheory9 Posts: 411
    edited December 1969

    Hi stringtheory9,
    I tried making a one-piece cloth today but still had poke-through with the settings I was trying. I was finding that the soft-body attach areas acted like solids and were passing through - much like as I showed in the pictures yesterday.

    Here is today's mesh. I made a second version with the skirt more like a cone but neither worked perfectly.

    Thanks Marcus. What are your scene physics settings set to? Try setting Simulation accuracy to 250 or 300% and Geometric fidility to 100%. With your poly count it shouldn't add very much simulation time.
    Also try deleting any polygons that aren't needed to support cloth movement like in the crotch area and the inside of the thighs. I found that these can rub together and cause problems along with increasing the complexity of the physics calculation which will slow down sim time.

    One thing that you need to watch out for when using one mesh for the entire lower avatar is that you don't soft attach vertices on the edges of joints to the wrong bone nodes. For example if you are selecting vertices for the thigh node and some of the vertices in the pelvic are get selected too, those mismatched attached vertices will punch through the cloth quite easily.

    I will check out your early posts. They sound interesting :-)

  • evilproducerevilproducer Posts: 9,050
    edited December 1969

    So, I take it you can make the under-layer a different shading domain and apply a shader with an alpha channel to hide it, correct? I'm only asking to put it out there, as I use C7.2 Pro and don't have soft body physics, so this purely an intellectual exercise for me at the moment.

Sign In or Register to comment.