Search Unity

[RELEASED] Cloth Dynamics

Discussion in 'Assets and Asset Store' started by Nexusmaster, Dec 9, 2020.

  1. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    175
  2. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,274
    Then you'd have to compare the same models. This way this doesn't compare anything at all.
     
  3. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    175
    After play with it one day, I would like to add some feature to the wish list.

    1. Mesh Tessellation or mesh smooth, I know it build in LOD or Proxy mesh for simulation, but tessellation will base on the mesh in simulation, make it much more smooth & easy to use.

    2. attach the cloth to object by string, not by local position(blue vertices) , it also make 2 pieces cloth can attached.
    3. attach object to the cloth. (add some decoration object to the cloth)
    4. cloth internal string, or you can paint 2 different property of cloth by vertices.
    5. readback function is very powerful, but too bad it doesn't count the weight. (I don't think too many people will use it)

    I think "Cloth Dynamics" is good enough, but it will make "Cloth Dynamics" perfect.
    and the garment system not so intuitive, not success to make anything, but that not cloth simulation main part.
     
    Last edited: May 8, 2021
  4. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    175
    I know it, this isn't real benchmark test, just give you the feel of different, I don't mean MagicaCloth not good, it more focus to game, and "MagicaCloth" it more focus to simulation.
     
  5. ghasedak3411

    ghasedak3411

    Joined:
    Aug 25, 2015
    Posts:
    23
    Hello
    I have clothes that have no skin or bones.
    Can this plugin work without skin and leave the costume on the character?
     
  6. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    365
    @victorkin11: Thank you for the test! It also shows that both systems are very fast ;-) Did you try the ClothDynamics character's dress with a MagicaCloth Sim?
     
  7. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    365
    Well, the cloth sim can also work without any skinning (bones) it just helps to stabilize when frames get skipped or jump e.g. when your character (or other objects that interact with the cloth) animation moves fast from one pose to another in one frame, the cloth will likely fall off or at least you see some skin through.
    But I created a simple Automatic Skinning component, which let your clothes add skinning in the Unity Editor, but the clothes should not penetrate the skin in static t-pose mode, when you do this.

    The Fight Scene from the demo shows clothes that are generated in Unity Editor and got Automatic Skinning applied at runtime.

    If you don't want to use skinning at all, you can try to decrease the "timestep" value or increase the "iteration num" and also use animations that are more naturally, meaning not so much position jumps (teleporting).
    Also you can attach vertices to your parent object and blend them with the simulation, so static parts of the cloth will hold the other dynamic parts. This is possible with the integrated vertex painter (blue vertex color is static, black is dynamic -> using the Point Constraint Type).

    If you want to blend with the skinning animation of your cloth (if any) you use the red vertex color.
     
  8. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    175
    There are Problem use ClothDynamics to Unitychan in MagicaCloth, MagicaCloth more like softbody simulation, also support bone, and multiply pieces for the character Hair simulation, but ClothDynamics can't have volume, and the clothDynamics don't have stiffness setting, check the right side Unitychan Hair tail.

    Screenshot (86).jpg
     
  9. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    365
    I meant: can you try my ClothDynamics character using MagicaCloth?

    Also, ClothDynamics has a stiffness control and also can keep volume if you setup it right. I will make a tutorial video, if I got more time. Thanks anyway.
     
    Last edited: May 11, 2021
  10. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    365
    You can use the unity inspector selecting the cloth material and add a texture, like a normal material. Maybe you have to select the cloth shader first, which you find under the shader graphs or cloth dynamics shaders, depending on your RP, and then add the texture. Also the example model might not have UVs. Then you need to edit the model via an external tool, e.g. you can export the model via my export tool in the Cloth Dynamics Menu at the top of the editor as obj to blender, and export it as fbx to unity, replacing the mesh.
     
    Last edited: May 11, 2021
  11. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    365
    Do you mean Tessellation via shader? That should be possible or can already be done by creating a custom shader. Also the other points are a good feedback, thanks!

    Currently the next planned features will be tearing cloth and more interaction with environment meshes. Because I need them for my own projects :D (Also some other users requested this before your requests came in)
     
    Last edited: May 11, 2021
  12. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    365
    New version is now online with Unity 2019 support!
     
    NexarChile and wetcircuit like this.
  13. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    175
    The new version need to manual install burst & unity.Mathematics to make it work!!
     
  14. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    365
    Yes. When you install burst normally mathematics should also be installed, because burst depends on mathematics.

    I decided manual install is a better choice, because unity installed some additional stuff when I used dependencies in the asset tool system.
     
  15. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    175
    I would like to know more about "cloth dynamics" how to handle the collider, there are a lot of asset will use collider on different purpose, when I use "animal controller" with "cloth dynamics", the character just keep rise to the sky, so I just move all "cloth dynamics" collider to water layer to fix it, but for real, we need to know how "cloth dynamics" use the collider, maybe we can reuse it on other purpose, or we just need to move all "cloth dynamics" collider to isolated layer for compatible.
     
  16. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    175
    I got a lot of same error when using "cloth dynamics" with other asset.
    "MissingReferenceException: The object of type 'SphereCollider' has been destroyed but you are still trying to access it.
    Your script should either check if it is null or you should not destroy the object."
    I wonder is cloth dynamics have create some temporary spherecollider, and delete it as run, if it is, maybe you should do it Awake() or OnEnable().
     
  17. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    365
    Hi victorkin11, at first thank you again for supporting and testing my product, that is very kind of you. Because this asset is new it's totally normal that bugs can happen. If there is some error message please always post which line of code and in which script it happens (reading from the top down of the the error message only the first appearance please). There a lot of different setups possible with other assets, so I can't make any situation fail-safe, but I will check the colliders and see what I can do, please keep calm. Thank you!
     
    Last edited: May 12, 2021
  18. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    365
    On Friday I will finally make some video tutorials (and bug fixes).
     
  19. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    175
    In my case, the error isn't direct come from "Cloth Dynamics", other plugin or asset try to scan the scene all collider, maybe by child or by distance and remember it, sometime for puppet rig doll body, sometime for other soft body, so that should be a compatible thing, not really a bug. But I have more than one asset have same error work with "Cloth Dynamics".
     
  20. vertexx

    vertexx

    Joined:
    Mar 18, 2014
    Posts:
    379
    Hate to say it but I can't see much difference (outcomes) than the default Unity cloth?
    Been following this thread and the Dev is trying so hard and is so committed..but..
    Unity cloth appears to be much simpler to set up and is free. The only difficult thing with UnityCloth are the initial colliders but that isn't too bad.
    But I'll hold on for a while and see before final decision. Thanks for this thread and your hard work!!
     
  21. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    175
    I just disable all ABS collider before run, everything just fine, so this may not a big problem, and it look like it won affect the cloth sim too.
     
  22. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    175
    This is my new test, a little bit long, just for fun.

     
  23. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    365
    Can you make a video where you use UnityCloth colliding with a real mesh? Not just simple physics colliders? No...so, that's one reason and another, Unity cloth vertex setup is really bad, this is much simple with my tool also Unity cloth can not deal good with high poly characters or clothes, Unity does not have Dual Quaternion Skinning, by default. Unity cloth does not have tearing (my tool soon has). Unity cloth can not create colliders automatically. Clothes meshes can not be created in the editor... without Cloth Dynamics.
    At first my tool looks a bit more complex, but if you get to know it, it is less complex than the unity particles system. But you are right in the case that it can be improved.
     
    Last edited: May 14, 2021
    JonBanana likes this.
  24. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    365
    Cool gameplay, looks promising!
     
  25. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    365
    Good to know, but I will still need to investigate the sphere colliders and find the issue.
     
  26. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    365
    Here is a video about mesh collision, also this is currently a bit limited, I try to show whats already possible.


    This video is using my garment tool to make a dress mesh.


    Here is the second part:


    (Btw. I fixed the cloth collision issue with the character when I pressed "Update Buffer Size" in the video (10:33) !)

    Sorry for my mumbling, I will try to improve this too! ;-)
    Cheers,
    Chris!
     
    Last edited: May 14, 2021
  27. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    175
    The tutor audio level is too low, I can't hear the detail, anyway thank for it, I finally finish my first dress.
     
    JonBanana likes this.
  28. garytencent

    garytencent

    Joined:
    Mar 10, 2020
    Posts:
    2
    Texture atomics are not support in Metal
     

    Attached Files:

  29. Sunstrace

    Sunstrace

    Joined:
    Dec 15, 2019
    Posts:
    40
    Is the demo updated? in the demo sometimes the skin may over the cloth.
     
  30. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    365
    Sorry, didn't test metal, but I think I can fix it. I just need to switch back to buffers instead of textures (for metal).
     
    Last edited: May 19, 2021
  31. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    365
    Sometimes that might happen, it depends on the cloth setup and the movement intensity. If you increase the substeps and the cloth-skin distance you can reduce this effect. But I'm also trying to improve this area, I already tested "Cloth Self Collision with Predictive Contacts", but it's hard to get this working without decreasing performance on my system, because this will alter the octree system.
     
    Last edited: May 19, 2021
  32. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    365
    So, I fixed the metal shader problem, no more errors, will be up in a few days!
    upload_2021-5-19_21-50-35.png
     
  33. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    175
    @Nexusmaster, About the penetrate problem, can you do some cheat about z depth, or move all the vertex toward the camera, some time the thing too close will get z conflict, so anyway you should add the bias option.

    For my view, "Cloth Dynamics" are almost complete functional, the main feature missing is string attach to object, or object attach to cloth by string, it should not too hard for you to make it.

    Of course if you can add two property blend with vertex paint, it will make "Cloth Dynamics" even greater.
    we can use one pieces of cloth to simulate multi material dressing.

    And some function I still not know how to use it, like proxy skin, it sound useful.

    sleeveless.jpg download (2).jpg download.jpg
     
  34. NexarChile

    NexarChile

    Joined:
    Apr 29, 2016
    Posts:
    17
    Cool @Nexusmaster ! Thank you very much for your excellent contribution. We already bought your asset!
    Have you already seen this project?
    http://mslab.es/projects/SelfSupervisedGarmentCollisions/
     
  35. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    365
  36. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    365
    Do you mean you want to connect (physX) meshes with a cloth e.g. having chains holding one cloth?
     
  37. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    175
    For e.g. more than one people to hold the cloth


    download (8).jpg
    and some thing attach to cloth like

    attachment.jpg download dd (3).jpg

    I find than when using Read Back collision will spawn collider in run time, if we can preview in editor, then we can attach some staff to the cloth.
     
  38. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    175
    object attach as run time

     
  39. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    365
    Thanks! I will look into this, and try to extend this feature!
     
  40. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    365
    I also checked the demo again, I think I did some wrong/bad settings for the cloth, it can be optimized, I will upload a new demo soon.
     
  41. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    365
    I'm now uploading version 1.5 to the store, however there are only some minor bug fixes and improvements e.g. iOS metal fixes, the big changes will come with the next version.
     
    Bartolomeus755 likes this.
  42. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    175
    About attach to object just like mouse interaction, but I want in scene character to pick up the handkerchief but not cursor to do so, the blue vertex constraints can't do that, it should very easy for you to implement it.
     
  43. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    365
    yes, I can implement this, maybe for the next update.
     
  44. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    175
    Thank!!
     
  45. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    365
    I just want everyone to know that with the next update the price will be raised dramatically! :cool:
     
  46. staron82

    staron82

    Joined:
    May 22, 2017
    Posts:
    19
    Hey,
    AutomaticBoneSpheres throws cast error if it's added to a model prefab.
     
  47. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    365
    Sorry, I never tested it with prefabs, only as scene objects. I will try to fix this. Are you using a Character which is setup-ed as Humanoid? Is the bones hierarchy visible? Because if this is not the case this also might lead to errors.

    AutomaticBoneSpheres tries to find a bone structure, which only works nice with Humanoids.
     
  48. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    175
    Suppose prefab can not add child object, and it is what automaticbonespheres doing, just unpack prefab completely, when you finish your setup, just make a new prefab with the new setting!
     
  49. Framehacker

    Framehacker

    Joined:
    Jan 30, 2020
    Posts:
    14
    Hello

    Im interested in this asset and would like to know if this works with UMA. If you dont know UMA, it basically saves its mesh data(clothes, body mesh etc) in additional scriptable objects and build the model at runtime. So i need to know if it is possible to save Cloth Dynamics data separate from the models after configuration and load in at runtime as well.

    Also some additional questions:

    - Does this asset has problems with non-uniformly scaled bones?
    - Can i use this with a generic rig instead of humanoid?
    - is there an ETA of the next update?
     
    Last edited: May 30, 2021
    ARon_w and JonBanana like this.
  50. staron82

    staron82

    Joined:
    May 22, 2017
    Posts:
    19
    Yes, it's a normal humanoid setup.