Search Unity

  1. All Pro and Enterprise subscribers: find helpful & inspiring creative, tech, and business know-how in the new Unity Success Hub. Sign in to stay up to date.
    Dismiss Notice
  2. Dismiss Notice

[RELEASED] Cloth Dynamics

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

  1. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    148
    Hi staron, I fixed the issue with the prefab, it was caused by the ABS Editor script, so for now you can change the AutoBoneSpheresEditor.cs to AutoBoneSpheresEditor.cs_bak to disable it.

    I sent the new fixed version (1.5.1) to the asset store, should be soon available!
    Thank you for finding this bug!
     
  2. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    148
    I will have a look at UMA and try it myself if it works with CD. Basically it should be possible. In Unity you can always save and load or copy component settings during runtime, but you need a script that does this for you. CD can also just be added at runtime, but depending on the cloth mesh it might take a while to load, so I added a pre-cache function that caches the cloth init data in a file, which can be loaded at runtime. Of course, this pre-cache only works when you don't edit the cloth mesh vertices and triangles at runtime.

    Edit: I had a quick look at UMA, I could add a support for this, but this might take some time, because the skinned mesh needs to be converted to a gpu skinning mesh, at runtime and this currently not always works with UMA. Also, the clothes need to be detached from the bodies to work. ABS also needs a fix to work with the UMA bones structure. SO, I would only start supporting this, if at least 20 people, who are using UMA, also want to use CD.


    - Does this asset has problems with non-uniformly scaled bones?
    I don't think so, I have a test scene where I scaled the "breast bones" of a character to zero, also included in the demo, however the vertices that get scaled can't use the skinning support functions anymore.

    - Can i use this with a generic rig instead of humanoid?
    Yes, but some functions e.g. the AutomaticBoneSpheres, might not work properly, but the AutomaticBoneSpheres are not required for the cloth sim to run. Basically you can use any mesh as a collider with the cloth, the ABS just creates simple colliders, like spheres or round cones, that might help/improve the collision in some cases, but I also have some great results with just pure cloth to mesh collision with good performance, really depends on your settings.

    - is there an ETA of the next update?
    Not really, but my plan is to release the next big version 1.6 in 2-3 weeks. Maybe I will ditch some features and add them to a later version, but I will definitely increase the price, if that's it why you asking ;-)
     
    Last edited: May 31, 2021
    SammmZ likes this.
  3. Framehacker

    Framehacker

    Joined:
    Jan 30, 2020
    Posts:
    4

    Thanks for the detailed answer, and even taking your time to try UMA out.

    Then lets hope we can make that 20 full, you can definitively count me in there.
     
  4. SammmZ

    SammmZ

    Joined:
    Aug 13, 2014
    Posts:
    124
    Hey! UMA is my main character framework so I would be happy to get UMA support.
     
  5. Uajrh1

    Uajrh1

    Joined:
    May 24, 2018
    Posts:
    2
    Would love some UMA support
     
  6. MightyDubster

    MightyDubster

    Joined:
    Apr 23, 2020
    Posts:
    1
    Count me in! I would love to use this asset if it had UMA integration.
     
  7. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    139
    @Nexusmaster
    Hi, I do have some more require, I know CD come with shader graphic source nod for customize your own shader, but it isn't work for build in render pipe line, and the build in render cloth shader function look very limit, as least support some cutout shader or transparent shader, it will be very nice.
     
  8. Bwacky

    Bwacky

    Joined:
    Nov 2, 2016
    Posts:
    19
    A UMA integration would elevate this asset gigantically for me - please consider adding support!
     
  9. EDarkness

    EDarkness

    Joined:
    Feb 1, 2013
    Posts:
    503
    Add in another person interested in UMA integration!
     
  10. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    148
    If you using the builtin system, maybe you are familiar with the surface shader system of unity, because basically CD uses this system, so if you know how to change/edit a surface shader you could also just edit the CD cloth shader or create a new one. CD looks for a shader with the naming "Cloth" so if your new shader name contains this, CD won't replace the shader and uses yours. https://docs.unity3d.com/Manual/SL-SurfaceShaders.html
    I can add a cutout or transparent shader in the next version as an alternative custom selection, but it's very easy to change it yourself. Hope this helps!
     
  11. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    148
    Currently there are some issues with the iOS Mac Metal system, so I will try to fix it. Anyone how also has problems with his Mac and CD can write me a PM or email, please, so I can debug better...
     
  12. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    139
    Thank!!
     
  13. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    148
    Just a quick soft body test with an icosphere and the current CD version:


    I would not say CD is ready for soft body sims, but it's not so far away.
     
  14. victorkin11

    victorkin11

    Joined:
    Apr 20, 2013
    Posts:
    139
    If you not show it, we just don't know what CD can do!! thank!
     
  15. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    148
    That's true, but I'm a bit lazy making all that videos and it takes longer than you think! :rolleyes:
     
  16. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    148
    Btw. In the advanced mode you can turn off the Garment Update if you are happy with the garment settings, this will increase the performance a bit.
    upload_2021-6-3_14-9-54.png
     
  17. JonBanana

    JonBanana

    Joined:
    Feb 5, 2014
    Posts:
    46
    Hi,

    I need dynamic cloth system for character who work on mobile, I already own obi cloth should i buy this asset instead ?
    What are the pros and cons ?

    Thank
     
  18. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    148
    Well, CD should be faster on modern mobile, because it uses the GPU. However, currently iOS is not tested and might be buggy. There might be a cloth to mesh vertex support for mobile with CD in the future. Obi normally uses a simple way to push the vertices away from the character, which I had problems with, that's why I started this asset. I think Obi might be better for non character stuff, but I'm more happy with my cloth system using it on the characters. I generally was not so happy with the Obi setup process and didn't get the results I wanted. But the main reason was the performance, but I didn't compare the performance on mobile yet, so can't tell you right now.

    Obi has some more features like tearing cloth, which I will add soon to CD.
     
    Last edited: Jun 4, 2021
    JonBanana likes this.
  19. JonBanana

    JonBanana

    Joined:
    Feb 5, 2014
    Posts:
    46
    Thank for your answer i ll put your asset in my wish list :)
     
  20. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    148
    Good news, I found a possible fix for the metal API issue, anyone who has problems with it, just try and increase the Voxel Cube Scale to 4 or higher so the cloth is completely covered in the voxel cube. This is just a quick fix, I will try to fix the issue via code asap.
     
  21. faintle2

    faintle2

    Joined:
    Jun 28, 2019
    Posts:
    6
    hi,
    Very interesting asset, great job! But when I tried the demo build, very low framerate and not cloth displayed, I'm using AMD ryzen, are there some compatibility problems with AMD?
     
  22. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    148
    What are your specs besides AMD (GPU) ? Are you using Windows10 x64 ?

    Edit: I just tested it on a Ryzen myself, and there is no problem with that. But there might be an issue with an AMD GPU, do you have one?
    If so, I think I can fix it... there was some problems with the AMD cards writing into IndirectArguments Buffers via shader. I thought it was fixed via driver update, but maybe it's not, do you have the latest driver? I can fix the IndirectArguments issue when I copy the buffer count, however this step is not so optimal, but possible.
     
    Last edited: Jun 11, 2021
  23. faintle2

    faintle2

    Joined:
    Jun 28, 2019
    Posts:
    6
    Thanks for your reply. Yes, I'm using the integrated gpu of ryzen 7 5750G with latest driver, win10 x64.
     
  24. faintle2

    faintle2

    Joined:
    Jun 28, 2019
    Posts:
    6
    The fps is less than 5 and all the clothes are missing
     
  25. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    148
    I can make a new demo with possible buffer fixes, next week, please try it out when it's done.
     
  26. faintle2

    faintle2

    Joined:
    Jun 28, 2019
    Posts:
    6
    Sure! Thanks
     
  27. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    148
    Hi, I was thinking about the teleporting problem (frame jumping), maybe I can improve the system by checking the next frame of the character's animation, and compare the difference. So if there are high variations in position, the system blends to skinning and if not it can turn off skinning.
     
  28. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    148
  29. faintle2

    faintle2

    Joined:
    Jun 28, 2019
    Posts:
    6
  30. faintle2

    faintle2

    Joined:
    Jun 28, 2019
    Posts:
    6
  31. pedropla

    pedropla

    Joined:
    Apr 9, 2018
    Posts:
    20
    @Nexusmaster do you have a mobile apk demo of this with an FPS counter I can test on mobile? I would definitely be interested in an uma version if it performs well on mobile.
     
  32. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    148
    Currently I have much work to do, I will try to make it next week...
     
  33. pedropla

    pedropla

    Joined:
    Apr 9, 2018
    Posts:
    20
    that would be awesome! Also can it easily be activated/deactivated based on LOD?
     
  34. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    148
    I called it LOD mode, but basically it blends from cloth sim to skinned cloth via distance, so you need the cloth to be skinned to the character.
    Edit: But I think you mean, that you have LOD cloth meshes, they can also have the cloth applied, currently each needs a cloth component.
     
  35. pedropla

    pedropla

    Joined:
    Apr 9, 2018
    Posts:
    20
    Thanks. If it runs well on mobile I’d definitely be interested in it on UMA.

    What I meant by LOD is that once it’s at a certain distance it no longer calculates cloth physics and acts as a normal skinned mesh for uma characters.
     
  36. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    148
    Yes, that works.
     
  37. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    148
    Btw. Currently everyone who makes a build should add the needed cloth shader, which is used in the cloth materials, to the included shaders e.g. URP:

    upload_2021-6-21_8-14-27.png

    I will make this automatic in the next version.
     
  38. pedropla

    pedropla

    Joined:
    Apr 9, 2018
    Posts:
    20
    Can this shader be added as an addressable?
     
  39. Nexusmaster

    Nexusmaster

    Joined:
    Jun 13, 2015
    Posts:
    148
    Currently the shader is in a Resources folder, when you make it an addressable you should copy the subshader graphs to the new directory or at least make sure the shader finds them... I can't support addressables, because not everyone uses them.
     
unityunity