Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[RELEASED] Magica Cloth

Discussion in 'Assets and Asset Store' started by hoshos, Jan 22, 2020.

  1. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903



    Hi everyone!
    Magica Cloth is a fast cloth simulation that runs on Job System + Burst Compiler.
    Ideal for shaking hair, skirts, breasts and more!
    Supports both Transform and mesh vertices.

    Now on sale at the asset store!:)






    Features:
    • Fast cloth simulation with Unity Job System + Burst compiler
    • No native plugin
    • Works on all platforms except WebGL
    • Implement BoneCloth driven by Bone (Transform) and MeshCloth driven by mesh
    • MeshCloth can also work with skinning mesh
    • Easy setup with an intuitive interface
    • Time operation such as slow is possible
    • With full source code

    Required:
    • Unity2018.4.0(LTS) higher
    • Project Settings [Allow 'unsafe' Code]
    • [Burst] package
    • [Jobs] package(preview)
    • [Collections] package
    • [Mathematics] package

    Unity Asset Store

    Documents (Japanese or English)
    (Click [English (United States)] for English documents.)

    Support E-Mail: support@magicasoft.jp
     
    Last edited: May 22, 2020
  2. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903


    Magica Cloth promotion video 2 has been added.
    The hair is BoneCloth, the shaking of the chest and breast is MeshSpring, and the cloth behind is MeshCloth.
    The model used Amarok3D's "Scythe girl".

    Model
     
    kinigeugfrwib and Freznosis like this.
  3. Freznosis

    Freznosis

    Joined:
    Jul 16, 2014
    Posts:
    298
    Is this a general purpose cloth simulation or only for skinned mesh? Like can we create a flag?
     
  4. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hi, Freznosis.
    It is not exclusive to skin mesh.
    Available for Transform (bone), MeshRenderer, SkinnedMeshRenderer.
    However, since it is designed with priority on the use of characters, it may be slightly unsuitable for the use of flags such as normal game worlds.
    Basically for characters.
     
    kinigeugfrwib likes this.
  5. witcher101

    witcher101

    Joined:
    Sep 9, 2015
    Posts:
    516
    Why it doesnt support webgl??
    Also does this supports collision. Can i push that cloth with spherecollider??
     
    kinigeugfrwib likes this.
  6. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hi, witcher101

    (1)WebGL
    Magica Cloth runs on Unity's latest technologies, the Job System and Burst Compiler.
    Unfortunately this feature doesn't seem to work currently with WebGL.
    It is discussed in the following forum:
    https://forum.unity.com/threads/job-system-webgl.523738/
    If Unity provides Burst compiler support for WebGL, Magica Cloth will work naturally.

    (2)Sphere Collider
    Yes, collision judgment by Sphere Collider, Capsule Collider, and Plane Collider is possible.
    However, the collider used in Magica Cloth is not compatible with the Unity collider.
    It is a separate implementation from Unity's physics engine.
     
    kinigeugfrwib likes this.
  7. b1gry4n

    b1gry4n

    Joined:
    Sep 11, 2013
    Posts:
    146
    How well does this work with a character that is in motion? By that I means actually physically moving in the world. The videos all show a character animating, but not moving. I have a character that goes at a normal speed as well as high speed. Will the simulation hold up under high speed situations? Also, what about wind?
     
    kinigeugfrwib likes this.
  8. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hi, b1gry4n
    Yes, characters can move around the world freely.
    There are no restrictions on movement.
    The video is simply stationary for shooting.
    There are also options to control the movement of the body.
    [World Influence] parameter.
    https://magicasoft.jp/en/paramater-world-influence-2

    By setting this parameter, you can specify how much the speed of the body is added to the particles.
    As a result, when the main body moves at high speed, the phenomenon that particles are disturbed can be suppressed.
    You can also set up teleportation.
    When the main body moves / rotates more than a certain amount in one frame, the movement of particles can be reset.
    This is useful for in-game teleport processing.

    "Wind" is not implemented in v1.0.0.
    However, it will be implemented in the near future, as it will be added to the items as a roadmap for the future.
     
    kinigeugfrwib likes this.
  9. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Currently, Unity2019.3 has confirmed that an error occurs when writing a prefab.
    We apologize for the inconvenience and are currently responding.
    ---- error message ----
    Code (CSharp):
    1. Assertion failed on expression: 'gForceReimports->empty()'
    2. UnityEditorInternal.InternalEditorUtility:ProjectWindowDrag(HierarchyProperty, Boolean)
    3. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    4.  
     
    kinigeugfrwib likes this.
  10. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    UPDATE:

    v1.0.1 has been released on the Asset Store.
    Fixed an issue where creating a prefab in Unity2019.3.0 caused errors and data corruption.
    If you use Unity2019.3.0, please be sure to update.
     
    kinigeugfrwib likes this.
  11. broberson

    broberson

    Joined:
    Jun 26, 2016
    Posts:
    11
    On either version of Unity (2019.3.0f6 or 2019.2.19f1), when creating a new project, adding the latest Burst and Jobs packages, setting the compilation options to .NET 4.x, IL2CPP, allow unsafe code, and importing Magica Cloth 1.0.1…

    When I run the UnityChanClothSample scene, the following error is emitted to the console, apparently every frame:

    Assertion failed on expression: 'offset + size <= bufLen'


    I'm not seeing what's causing this error. Disabling the "Magica Mesh Cloth", "Magica Mesh Spring BL" and "Magica Mesh Spring BR" objects on UnityChan stop the errors, but I've been unable to narrow it down further.
     
    kinigeugfrwib likes this.
  12. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hi, broberson.
    We apologize for any inconvenience.
    I saw this error for the first time.
    There seems to be no problem with the setup.
    Could you tell me in which environment, windows / mac?
    Also, would you please give me the full text of the error message (all of the logs)?
    Thank you.
     
    kinigeugfrwib likes this.
  13. broberson

    broberson

    Joined:
    Jun 26, 2016
    Posts:
    11
    I'm on macOS. There is no full text - that's all that shows up.




    Created a new project using Unity 2019.2.19f1


    Chose the default, standard graphics pipeline project template



    Added the latest version of Burst from the package manager



    Added the latest version of Jobs from the package manager


    Changed the Scripting Backend to IL2CPP, the API Compatibility level to .NET 4.x, and checked the box to Allow "unsafe" Code


    Imported Magica Cloth 1.0.1 (all files)

    The following warnings showed up after import, all related to the UnityChan FBX file.


    Verified the version of Magica Cloth




    Running on macOS Mojave
     
    kinigeugfrwib likes this.
  14. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Thanks broberson for the detailed image.
    There is no problem with the setup at all.
    There is a warning about importing FBX, but this is a problem on the Unity-Chan model side, so don't worry.
    This is information on the net. Can you test by setting [Metal Editor Support] of Edit-> Player Settings ..-> Player to On or Off?
    There was a statement that a similar error was recovered.

    Another one.
    Would you please manually [Create] all the MagicaCloth components attached to the [unitychan] prefab as shown in the image?

    The execution order is [RenderDeformer]-> [VirtualDeformer]-> [MeshCloth]-> [MeshSpring]-> [BoneSpring].
    There is a possibility to improve by recreating the data.
    Thank you.
     
    kinigeugfrwib likes this.
  15. broberson

    broberson

    Joined:
    Jun 26, 2016
    Posts:
    11
    This makes the errors go away. With Metal Editor Support ON, there are no errors reported with any other sample scenes.

    This had no effect on the errors.


    At this point, it seems like Unity's Metal API support in the editor is just being too picky. Probably best to just wrap the two calls to mesh.MarkDynamic() in RenderMeshDeformer.cs with a preprocessor directive:

    #if !UNITY_EDITOR_OSX
    mesh.MarkDynamic();
    #endif


    MarkDynamic is supposed to make manipulating the mesh more performant, but I'm getting faster frame renders in the editor without it. I don't think that, on Metal, MarkDynamic does anything besides throwing an assertion error. This doesn't generate any errors in the logs written by a development build of the game, so it really does seem like an editor-only issue.

    Maybe that helps?
     
    Last edited: Jan 31, 2020
    kinigeugfrwib likes this.
  16. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Thank you for the report!
    The cause is unknown, but [Metal Editor Support] is a flag related only to the editor, so it probably has no effect on the build.
    Can you use it in this state for a while?
    Document it as a known bug.
    I ordered a MacBook today because I didn't have a Mac. I think it will arrive in a few days.
    If you find out the cause, I will report it on this forum, so please give me some time.
     
    kinigeugfrwib likes this.
  17. broberson

    broberson

    Joined:
    Jun 26, 2016
    Posts:
    11
    I edited my previous response with a possible fix for you.

    Basically, mesh.MarkDynamic() makes the Unity Editor's Metal implementation angry with certain meshes. There doesn't appear to be anything that can be done with UnityChan that would work around the problem. Spheres and Quads and Cubes seem to be fine. Skipping the call to MarkDynamic() when running in the MacOS Editor is probably a safe default.
     
    kinigeugfrwib likes this.
  18. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    #if !UNITY_EDITOR_OSX
    mesh.MarkDynamic();
    #endif


    This is very helpful!
    I would like to test this code and release v1.0.2 as soon as I receive my MacBook.
    Thank you very much for fixing the bug.
     
    kinigeugfrwib likes this.
  19. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    851
    Hey, I have a question / problem:

    I just bought the asset and am testing it out. Works fine for me with "statric " cloth. However, I also have some bone driven cloth (where bones move parts of the vertices in SkinnedMeshRenderer). Seems as soon as I enable MeshCloth, the connection between bones and the SkinnedMesh is gone, the cloth is not moving in sync with the bones anymore. Is this expected behavior, or do I need to do something special to make it work ?
    Best,

    Qleenie
     
    kinigeugfrwib likes this.
  20. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hi, Qleenie.
    I'm translating, so you may be a little confused, but please forgive me.
    Unfortunately, it is currently not possible to mix MeshCloth and BoneCloth on the same vertex.
    When using MeshCloth, the vertices will be [Moved] [Fixed] [Invalid] as panes.
    At this time, the [Moved] and [Fixed] vertices are occupied by MeshCloth and are not affected by other cross components.
    However, the vertices of [Invalid] are excluded from the influence of MeshCloth, so they can be transformed from other BoneCloth.
    In the image example, the gray [Invalid] particles will work with BoneCloth.

     
    kinigeugfrwib likes this.
  21. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    851
    Tanks for the prompt response!
    What I want to achieve is, that e.g. the invalid vertices will be still moved by the bones connected to SkinnedMeshRenderer, so that e.g. on a t-shirt, parts of the arm are moved with the bones of the character.
     
    kinigeugfrwib likes this.
  22. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Sorry for my lack of understanding.
    Is it a problem that can be solved if MeshCloth and BoneCloth can be shared?
     
    kinigeugfrwib likes this.
  23. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    851
    Not sure what to do with bonecloth in this case. I would just like to use the normal internal unity mechanism of SkinnedMeshRenderer to drive vertices of my cloth with bones / transforms, and add cloth simulation on top of this. But as soon as I add magica cloth, the bones seem not to influence the vertices anymore.
     
    Last edited: Jan 31, 2020
  24. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    In other words, do you want to move the same mesh with other cloth simulation assets (Unity cloth, Dynamic bone ... etc) and MagicaCloth?
    If so, would you please give me the name of the asset?
     
    kinigeugfrwib likes this.
  25. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    851
    No, just with normal internal SkinnedMeshRenderer of unity. I have a cloth setup with the same bones as the character, so that it character and cloth stay in sync. And this does not work anymore, as soon as I use Magica Cloth.
    Maybe to give additional detail: as my cloth and my character have same bone setup, I am copying the bones from character to the cloth on Start(). Without MagicaCLoth, the cloth is driven by the character bones, as soon as I enable Magica Cloth, the cloth seems to be decoupled completely from the character rig / bones.
     
    Last edited: Feb 1, 2020
    kinigeugfrwib likes this.
  26. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    I hope this is the answer ...
    As shown in the image above, MeshCloth has three vertex marks [Invalid (gray)] [Fixed (red)] [Move (green)].
    The vertices of [Invalid] and [Fixed] can be moved by moving the bone.
    However, the vertices of [Move] are not reflected even if the bones are moved manually because they are occupied by cross simulation.
    This is the current specification.
     
  27. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    851
    This is exactly what I would want, but it does not seem to work in my case, maybe because I am coping the bones with a script from the character to the cloth. The reason for this is to keep cloth separated from character, even if it has same bone structure.
    So in my case, as soon as Magica Mesh Cloth is added, no vertices are driven by bones anymore, not even the red or grey ones.
     
  28. vorokoi

    vorokoi

    Joined:
    Oct 18, 2019
    Posts:
    39
    Just wanted to say thank you for releasing this. It is amazing work you have done. My cloth simulations look and perform fantastically well. Best asset of its kind!
     
  29. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Sorry for not helping.
    However, bones affected by [invalid] [fixed] vertices can be moved freely, so if it is not, it may be a design error.
    I will continue to investigate this issue.
     
  30. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hi, vorokoi!
    Thanks for the evaluation.
    Some bugs are still reported, so we will fix them first.
    When that's done, we'll add new features.
     
  31. lorddesu

    lorddesu

    Joined:
    Aug 20, 2014
    Posts:
    31
    How good it works for mobile? Any fps tests?
     
  32. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hi, lorddesu!
    MagicaCloth performance varies greatly depending on the number of CPU cores.
    Android / iPhone released after 2019 should work pretty well.
    If you are worried, we will give you an evaluation version.
    Please email support@magicasoft.jp.
     
  33. sidebi

    sidebi

    Joined:
    Jun 16, 2015
    Posts:
    2
    Is there any good way to use it in 2018.3? As you know updating whole project is almost impossible for big project.
     
  34. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hi, sidebi.
    Sorry, currently does not support Unity2018.
    However, due to many requests, we are currently working on Unity2018.4 (LTS).
    This will take a little longer, but please wait for Unity2018.4 to work.
    It is Unity2018.3, but it should probably work with Unity2018.4 (LTS).
     
    XCO likes this.
  35. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    UPDATE:

    v1.0.2 has been released on the Asset Store.
    Fixed an issue that caused an error when running in a Mac editor environment.
    http://u3d.as/1Hzx
     
  36. Ukounu

    Ukounu

    Joined:
    Nov 2, 2019
    Posts:
    209
    If cloth used by MagicaCloth simulation cannot be controlled by SkinnedMeshRenderer and/or by manual bone rotations at the same time, it will be not useful for most uses involving simulation of character clothes/hair, I think.
    As Qleenie already mentioned above, correct implementation for clothes is to have them first animated/rotated by bones, and any additional simulation should be applied on top of that. Because in real games there are numerous cases when the only solution is to animate cloth bones manually (to solve all clipping issues).
    E.g., a character with long skirt sits on a chair, and skirt clips right through the chair. Or character crouches/crawls on the ground, and skirt (or other long clothes) begin to clip through body, because there is not enough room for it between legs and body. Things like that can be solved through additional manual animation of bones controlling clothes, so that clothes will bend/fold correctly in all possible poses.
    I didn't try MagicaCloth as yet, but in the past I experimented extensively with other similar solutions for animating clothes, and I know already that any cloth animation system that doesn't allow to handle correctly clipping of clothes through chairs and such is useless for any practical implementation.
    Your asset looks very good already, and if you could remake it to allow implementation on top of clothes animated by bone rotations, it would be perfect. If that's possible at all, that is.
     
    Last edited: Feb 4, 2020
    kinigeugfrwib likes this.
  37. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hello, Ukounu.
    Thank you for the detailed explanation.
    Sorry for my lack of understanding.
    I have found this issue to be quite important.
    I do not yet fully understand it and will continue to do so.
    I would be happy if there were any specific examples.
    For example, if you have something like this function of other cloth simulation, this function of UnrealEngine, can you tell me?
    I would be glad if there was a web link etc.
     
    kinigeugfrwib likes this.
  38. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    UPDATE:

    v1.0.3 has been released on the Asset Store.
    The problem that data link is suddenly broken in Unity2019.3 has been fixed.
    If you use Unity2019.3, please update.
    http://u3d.as/1Hzx
     
    kinigeugfrwib and vorokoi like this.
  39. corjn

    corjn

    Joined:
    Feb 6, 2014
    Posts:
    168
    Hey @hoshos

    I'm considering to buy magica cloth, but I can read in the reviews your asset currently does not support surface penetration option. Just wanted to know if it's on your roadmap.

    Thanks in advance for your time :)
    Jonathan
     
    kinigeugfrwib likes this.
  40. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hi, corjn!
    Unfortunately, "surface penetration" is not implemented.
    There are currently two defenses that can be taken.
    (1) Clamp Position
    Limits the distance that particles can travel from the origin.
    https://magicasoft.jp/en/paramater-clamp-position-2/

    (2) Clamp Rotation
    It is possible to limit the angle that can be tilted relative to the parent.
    https://magicasoft.jp/en/paramater-clamp-rotation-2/

    These two prevent the particles from moving excessively.
    Several people have asked about "surface penetration" and understand the importance of this feature.
    I have tested it and will report on this forum once the implementation is ready.
     
    kinigeugfrwib and corjn like this.
  41. Ukounu

    Ukounu

    Joined:
    Nov 2, 2019
    Posts:
    209
    https://imgur.com/SZmWSi7

    Here is a simple example. A girl with a tail walks around. Tail is wiggling all the time by using SkinnedMeshRenderer. If your component was applied to bones in the tail, it also would bend realistically during jumping/running/crawling, and detect collisions with legs. But then it would be impossible to animate wiggling motion by using SkinnedMeshRenderer. That's why it's necessary to apply physics to bones without disabling animations.

    +1 vote for version compatible with Unity 2018. 2019 in its current state is a broken mess. It doesn't even support importing any 3D models with animations... https://forum.unity.com/threads/uni...iple-animation-clips-from-blend-files.819429/

    +1 vote for wind. Wind is absolutely necessary for realistic clothes/hair simulation.
     
    Last edited: Feb 9, 2020
    kinigeugfrwib likes this.
  42. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Thank you for a specific example.
    I understood that I wanted to add physics calculations while moving the tail in the animation.
    This is feasible.
    In such cases, it is best to use BoneCloth.
    There are three features that can help.

    [Clamp Postion]
    Particles can limit the range they can move from their original animated position.
    This is the same function as UnityCloth's [MaxDistance].
    https://magicasoft.jp/en/paramater-clamp-position-2/

    [Clamp Rotation]
    Particles can limit the angle at which they can bend from their animated position.
    For example, if you set the angle limit to 10 degrees, the tail will only bend 10 degrees from the root to the current animation pose for each bone.
    https://magicasoft.jp/en/paramater-clamp-rotation-2/

    [Restore Rotation]
    Particles are forced back to their original animated angle.
    Simply put, it tries to return to its original position.
    https://magicasoft.jp/en/paramater-restore-rotation-2/

    By using these depending on the situation, it is possible to perform a simulation while maintaining the original posture.

    One thing to worry about is [Update Mode] of Animator set to [Animate Physics]?
    With this setting, any animation movement will not be linked to BoneCloth / MeshClot.
    If so, this is my design mistake.
    [Animate Physics] has not been tested.
     
    kinigeugfrwib likes this.
  43. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    UPDATE:

    v1.1.0 has been released on the Asset Store.
    From this version, it works on Unity2018.4.0 (LTS) or higher!:)
    http://u3d.as/1Hzx

    feature: Added support for Unity2018.4 (LTS).
    improvement: Error details are now displayed along with error codes.
    improvement: Vertex paint now records by vertex hash instead of vertex index.
    fix: If two or more MagicaPhysicsManagers are found, delete those found later.
     
    kinigeugfrwib likes this.
  44. Devsagi

    Devsagi

    Joined:
    Sep 28, 2019
    Posts:
    33
    Hello hoshos,

    I'd be interested in trying this asset out.
    Could you tell me if adding the required packages ( [Burst] package, [Jobs] package(prevewe), [Collections] package, [Mathematics] package) would have any other impact on my project?
    Is there a demo version available?

    With best regards
     
    kinigeugfrwib likes this.
  45. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hi, Devsagi.
    Thank you for your interest.
    There is basically no problem installing the package.
    However, since the package is still a beta version, there may be a defect.
    There is an evaluation version of v1.1.0, so please test it.
    I'll give you a download link in [conversation].

    [ADD]
    I wrote a download link in [Inbox -> Conversations].
    I haven't used conversations very much, so if you can't see it, let me know.
     
    Last edited: Feb 12, 2020
    kinigeugfrwib and Devsagi like this.
  46. Devsagi

    Devsagi

    Joined:
    Sep 28, 2019
    Posts:
    33
    Thank you,

    I will be glad to try it out and give you a feedback as soon as I could test it in my project.

    Best regards
     
    kinigeugfrwib likes this.
  47. one_one

    one_one

    Joined:
    May 20, 2013
    Posts:
    621
    Why is IL2CPP required for this asset?
     
    kinigeugfrwib likes this.
  48. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    903
    Hi, one_one!
    I was surprised to hear from you.
    [Burst Compiler] did not require IL2CPP.
    This is my lack of understanding.
    Therefore, there is no problem even if you uncheck IL2CPP.
    I'll post this in the documentation later and modify the installation guide.
    Thank you.
     
    kinigeugfrwib, LudiKha and one_one like this.
  49. one_one

    one_one

    Joined:
    May 20, 2013
    Posts:
    621
    Thanks for your quick reply, good to hear!
     
    kinigeugfrwib likes this.
  50. Acissathar

    Acissathar

    Joined:
    Jun 24, 2011
    Posts:
    677
    Hi,

    A quick question that I’m sure is already answered in different terms, but just want to double check.

    I have characters that are a single skinned mesh, however, their rig includes bones for various parts of clothing and hair. Will MagicaCloth work using just those extra bones?

    Thanks!
     
    kinigeugfrwib likes this.