Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

[RELEASED] MagicaCloth2 - Hybrid Cloth Simulation

Discussion in 'Assets and Asset Store' started by hoshos, Feb 5, 2023.

  1. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    940
    Hello.
    We apologize for any inconvenience caused.
    I can't reproduce the problem here, so it's speculation, but it's probably due to the order in which the components and the manager system are stopped.
    I've created a version with the potential problems fixed, so I'll send you a DM.
    Could you please test with this version?
     
  2. JohngUK

    JohngUK

    Joined:
    Aug 8, 2019
    Posts:
    11
    Hi, I am using Magica Cloth2 in a game I am developing in Unity version 2021.3.24f1. In order to take advantage of all the new DOTS features, such as DOTS networking, animation, and the Unity DOTS character controller, I am porting the game to Unity 2022.2.17f1. I (not surprisingly) get unresolved references 'NativeParallelMultiHashMap' when I install Magica Cloth 2 into 2022.2.17f1. I am using a workaround at present by installing Magica Cloth2 into 2021.3.24f1 then upgrading the Unity version of the Project to 2022.2.17f1. Unity seems to sort out the unresolved references and Magica Cloth2 seems to work fine in Unity 2022, but breaks when I install other packages with later versions of ECS. Will you be releasing a 2022 version of Magica Cloth 2, or will you wait for 2022 LTS? Thanks in advance.
     
    Last edited: Apr 29, 2023
  3. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    940
    Hello.
    Don't worry, MagicaCloth will also work with Unity2022/2023.
    The condition for running MagicaCloth2 is that Burst 1.8.1 or higher and Collections 1.4.0 or higher are installed.
    If an error occurs, first check with the package manager whether this condition is met.
    If the version is old, please update manually.

    This is speculation, but it may be that the version of Burst/Collections is forcibly reverted when installing other packages.
    Please pay attention to this point.

    <Add>
    one more.
    If the Jobs package is installed, please remove it.
    The Jobs package was merged into Collections 1.4.0 and has been discontinued.
    Therefore, an error will occur if the Jobs package remains.
    Maybe some other old package is forcing Jobs to be installed.
    After finishing the work, please restart the Unity editor once.
     
    Last edited: Apr 29, 2023
  4. JohngUK

    JohngUK

    Joined:
    Aug 8, 2019
    Posts:
    11
    Thanks for super-quick reply - it was conflicting versions in other packages, installed other packages first, then updated 2022 to latest package versions before installing MagicaCloth2. Restarting was also useful to get rid of errors. All working now in 2022.2.17f1 Brilliant!
     
    Last edited: Apr 29, 2023
    hoshos likes this.
  5. DGordon

    DGordon

    Joined:
    Dec 8, 2013
    Posts:
    649
    Would this work to add cloth physics to a movie recorded through timeline? Meaning, if I added this to characters and then hit record, when the recorder goes frame by frame through the timeline in play mode, would this react appropriately? I have v-roid characters and it would be great to add this to them where it makes sense. Im using the recorder found in the hdrp cinema package to create a movie.

    Thanks!
     
  6. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    940
    Hello.
    We don't officially support timelines, so we can't guarantee that they will work.
    However, in the end, it's the same as animating a character, so I think it will probably work well.
    Sorry for the vague answer, but in the end you won't know until you test it.
     
  7. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    940
    Update:2.1.0

    v2.1.0 has been released on the Asset Store!
    https://u3d.as/2Zc3

    A new wind system has been added!


    • Specifying the range of wind such as spherical / box type
    • Adjustable wind effect for each MagicaCloth component
    • Generates wind automatically when moving
    • Animation-like shaking can be reproduced by sine waveform
    • Sine and noise waveforms can be blended
    See the following document for details.
    https://magicasoft.jp/en/mc2_wind_setup/

    Release Note:
    Added: Added wind system. You can specify the area affected by the wind and control how each component is affected by the wind.
    Added: Added wind system sample scene.
    Improvement: Retuned UnityChanKAGURA for wind system.
    Improvement: Extended SimpleDistance and ShapeDistance distances in reduction settings
    Improvement: Changed to inherit the name of the parent object when adding a collider.
    Fix: Addressed a rare collider manager error when stopping execution in the Unity editor.
    Fix: Fixed an issue where resizing with SetSize() on Capsule Colliders would misbehave.

    https://magicasoft.jp/en/mc2_releasenote/

    How to Update
    Please follow the following steps to update the software as much as possible.
    (1)Backup your project
    (2)Delete the MagicaCloth2 folder from the Unity editor
    (3)Import the latest MagicaCloth2 from PackageManager
     
    TylkoDemon and JohngUK like this.
  8. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    940
    Update:2.1.1

    v2.1.1 has been released on the Asset Store!
    https://u3d.as/2Zc3

    This is an urgent update because we found a major bug with the wind system.

    Release Note:
    Fix: Fixed an issue where the sway period was disturbed when the wind force fluctuated.
    https://magicasoft.jp/en/mc2_releasenote/

    How to Update

    Please follow the following steps to update the software as much as possible.
    (1)Backup your project
    (2)Delete the MagicaCloth2 folder from the Unity editor
    (3)Import the latest MagicaCloth2 from PackageManager
     
  9. Chris_Webb

    Chris_Webb

    Joined:
    Mar 18, 2014
    Posts:
    128
    Hello,

    Thank you very much for this plugin, it looks fantastic and runs really well.

    Is there any way to use LODed meshes with MeshCloth?

    We would like to have one MeshCloth, which is shared with several LODed meshes, inside a LODGroup.

    This is a really important feature for us to achieve performance and quality goals.

    Thanks so much :)
     
  10. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    940
    Hello.
    Unfortunately there is no support for LODGroups yet.
    However, we understand that this feature is important.
    So we added it to our roadmap.
    https://magicasoft.jp/en/mc2_roadmap/

    I'm going to try an experiment later, but I have other work to do, so it may be around autumn.
     
  11. Chris_Webb

    Chris_Webb

    Joined:
    Mar 18, 2014
    Posts:
    128
    Thank you so much, I really appreciate it :)
     
  12. Chris_Webb

    Chris_Webb

    Joined:
    Mar 18, 2014
    Posts:
    128
    Hello,

    Are there plans to add distance disable to MC2, as there was in MC1? Is this part of "Culling System" on the roadmap?

    Thanks :)
     
  13. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    940
    Yes, it will be implemented.
    This will be implemented as one of the culling systems.
    I think it will probably be around June.
     
    Chris_Webb likes this.
  14. DigitalAdam

    DigitalAdam

    Joined:
    Jul 18, 2007
    Posts:
    1,215
    @hoshos

    Hey, how do I get the cloth from not stretching? I have a skirt, using the Skirt preset. When I play the scene it stretches to twice it length since the gravity is set to 5. If I change it to 1, it stretches to almost the normal length, but it doesn't move realistically. I'm probably missing a setting.

    Second question: my character has a variety of body sizes using blendshapes. My clothing is skinned to my mesh, and the clothes also have blendshapes that match. What do you recommend about handling blendshapes with your asset?

    Also, do you have a Discord?

    Thanks!
     
    Last edited: May 9, 2023
  15. Chris_Webb

    Chris_Webb

    Joined:
    Mar 18, 2014
    Posts:
    128
    Hello,

    We are using bone cloth on a sash, using Connection mode: Sequential non loop.

    Previously this worked fine in MC1, but since updating, the bones simulate correctly, but the mesh is not moved.
    When we set the top bones on the sash to fixed, the mesh moves correctly, but the behavior is not as desired. We would like the entire sash to be able to move around, as it did in MC1.

    Do you have any idea what might be the issue here, and why with the top fixed verts, the mesh does not update?

    I have attached images for the broken and working configuration.

    Thanks so much
     

    Attached Files:

  16. Faisal_Azizi_

    Faisal_Azizi_

    Joined:
    Feb 5, 2021
    Posts:
    25
    Hello! I have been using magica for a while now its only recently that i encountered this where the gizmoz is not drawn properly when the magica cloth component is selected.

    Not only that editing the values will not reflect on the model unless you close and reopen the prefab.
     

    Attached Files:

  17. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    940
    Hello.
    First, is the skirt MeshCloth or BoneCloth?
    If MeshCloth, check if the proxy mesh vertex reduction is appropriate.
    Please check the following setup guide again.
    https://magicasoft.jp/en/mc2_meshclothstartguide/#Render_mesh_and_proxy_mesh

    Basically, it is not suitable to use the vertex structure of the display mesh as it is for simulation.
    If you use the display mesh as it is, the number of vertices will be too large, causing the mesh to stretch like this time.
    So the proxy mesh should be as simple as possible.
    Of course it depends on the original mesh structure.
    If the original mesh structure is low-polygon, you don't have to worry about this.

    About blendshapes.
    Unfortunately blendshapes are not supported.
    MagicaCloth cannot be used if the clothes are deformed by blendshapes according to the body shape.
    However, if the vertices of the blendshape and the vertices operated by MagicaCloth do not overlap, it is possible to use both in one mesh.

    Finally, there is currently no Discord.
     
  18. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    940
    Hello.
    Please understand that I can't answer clearly because I don't know the actual mesh and transform structure.
    Probably, I think that the bones that were not originally connected as Transform were combined using the BoneCloth loop connection.
    It is said that it worked in Ver1, but such a structure is not recommended.

    The best solution in this case is to use MeshCloth.
    Apply a MeshCloth to the band and set it to reduce vertices considerably.
    And fix the waist part like the image.

    How about using this MeshCloth?
     
    Chris_Webb likes this.
  19. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    940
    Hello.
    It's probably because the gizmo toggle button in the upper right corner of the scene view is turned off.
    When this toggle button is OFF, all Unity gizmos are hidden.
    Please turn on this button.

    mc2_gizmo_toggle_2023-05-10-1.jpg
     
    Faisal_Azizi_ likes this.
  20. Chris_Webb

    Chris_Webb

    Joined:
    Mar 18, 2014
    Posts:
    128
    Hello,

    Thank you for the reply. We have been trying to avoid using meshcloth for LOD reasons.
    We just find it slightly strange that the mesh generated seems correct, but nothing skins.
    It is okay though, we are going to replace the belt with a single row of transforms, which works just fine :)

    Thank you
     
  21. Faisal_Azizi_

    Faisal_Azizi_

    Joined:
    Feb 5, 2021
    Posts:
    25
    Lmao that fixed it. Thanks for the help i completely forgot about that
     
    hoshos likes this.
  22. DrMeatball

    DrMeatball

    Joined:
    Nov 21, 2021
    Posts:
    115
    Hello - love this asset - ty!!

    Having an issue with Mesh Cloth.. basically everything I paint green/movable disappears when hitting play.

    Screenshot 2023-05-10 105706.png Screenshot 2023-05-10 105716.png Screenshot 2023-05-10 105929.png
     
  23. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    940
    Hello.
    First, is this a problem only with this dress?
    Are other costumes okay?
    Also, does UnityChanKAGURA in the sample scene work?
     
    DrMeatball likes this.
  24. DrMeatball

    DrMeatball

    Joined:
    Nov 21, 2021
    Posts:
    115
    Sample scenes work great! And I've had Cloth2 working on this same mesh before, but it sometimes seems to just stop working occasionally and I haven't figured out why.

    Recreated everything and it's now working.. is it possible my Reduction Settings were bad?
     
  25. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    940
    Thank you for your reply.
    OK, this seems a bit esoteric.
    Can you reproduce the error 100% with this dress?
    If so, can I get a project to reproduce the problem?
     
  26. FlightFight

    FlightFight

    Joined:
    May 29, 2017
    Posts:
    27
    Hello John, can Magica Cloth 2 be used from ECS 1.0? Does it rely on GameObjects to work properly?
    I'm also wondering what you are referring to by "DOTS animation"?
     
  27. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    940
    Update:2.1.2

    v2.1.2 has been released on the Asset Store!
    https://u3d.as/2Zc3

    Bugs such as crashes and memory leaks have been fixed.
    Also, some features have been improved.

    Release Note:
    Improvement: Changed MagicaPhysicsManager.OnPreSimulation event call location to correct location.
    Improvement: Changed to automatically execute speed stabilization process after simulation reset.
    Improvement: Fixed an issue where some system jobs were still working even with all cloth components disabled.
    Improvement: Changed to reset the simulation when enabling disabled cloth components.
    Fix: Fixed a rare app crash when a component was destroyed during cloth data construction.
    Fix: Fixed a rare memory leak when a component was destroyed during cloth data construction.
    Fix: Fixed an issue where disabling a cloth component, changing its position, and enabling it would cause the simulation to distort.
    Fix: Fixed a rare error in the Collider Manager when ending play in the editor.
    Fix: Fixed rare assert issue with VirtualMeshManager.CalcTriangleNormalTangentJob.
    Fix: Fixed an issue where GetHashCode() would cause an error when using external assets such as Odin.
    https://magicasoft.jp/en/mc2_releasenote/

    How to Update

    Please follow the following steps to update the software as much as possible.
    (1)Backup your project
    (2)Delete the MagicaCloth2 folder from the Unity editor
    (3)Import the latest MagicaCloth2 from PackageManager
     
  28. Alexdbz

    Alexdbz

    Joined:
    Dec 5, 2022
    Posts:
    4
    Hi! I love your tool, any chance you can give me advice for this? the sleeves keep going through the dress even tho I set up colider. Note that Hanfu1 (the skinned mesh rendered is all part of one mesh) same for the white dress she is wearing I haven't added any colliders or magic cloth to a white dress. Thanks in advance
     

    Attached Files:

    • 1.png
      1.png
      File size:
      1.5 MB
      Views:
      83
    • 2.png
      2.png
      File size:
      1.5 MB
      Views:
      83
  29. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    940
    Hello.
    Is this a question about self collision?
    Or is the setting only for normal colliders?
     
  30. Alexdbz

    Alexdbz

    Joined:
    Dec 5, 2022
    Posts:
    4
    normal colliders the sleeves keep going through them for some strange reason do you have any advice on how to paint sleeves so they bounce off. Rest of the mesh is working fine
     

    Attached Files:

  31. JohngUK

    JohngUK

    Joined:
    Aug 8, 2019
    Posts:
    11
    I'm using a package from the Unity Asset store:
    https://assetstore.unity.com/packages/tools/animation/rukhanka-ecs-animation-system-241472
    This uses custom URP/HDRP Shadergraph shaders to animate the character meshes from generic animations - I have modified the URP shader in the Shadergraph editor to add transparency and tiling and it still works!
    I haven't merged this animation package with Magica cloth yet however - this may present problems.
     
    Last edited: May 15, 2023
    FlightFight likes this.
  32. Ignacii

    Ignacii

    Joined:
    May 23, 2013
    Posts:
    121
    Hello. Can I use both 1 and 2 versions of the asset at the same time? I've put in quite some work with the Magica Cloth 1 so want to use 2 for new stuff only. Thank you
     
  33. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    940
    I still don't quite understand the problem.
    Does it mean that the sleeves of the dress are not responding to the collider of the legs at all like in the image?

    mc2_2023-05-16 091707.jpg

    If so, isn't the collider's collision mode set to [None]?
    Or does it mean that the sleeve moves to the back side of the collider even though it reacts?
     
  34. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    940
    Hello.
    It is possible to use Ver1 and 2 at the same time.
    However, two similar systems reside resident, which is not good for performance.
    There is no problem if it is a test environment, but please be careful when distributing the actual application.
     
    Ignacii likes this.
  35. doranikofu

    doranikofu

    Joined:
    Feb 12, 2021
    Posts:
    3
    when I use the reduction settings, I often get an error. Increasing the parameters to further simplify the mesh solves the problem. Is this a performance problem due to too many vertices, or some calculation bug?
    Looks not that like a performance issue. I tried to turn off all collision, still same problem.

    errold: Assert failed
    This exception was thrown from a job complied with Burst, which has limited exception support.
     
    Last edited: May 16, 2023
  36. Alexdbz

    Alexdbz

    Joined:
    Dec 5, 2022
    Posts:
    4
    Sleeves arent responding to collider on the leg I dont know why and I am not sure how to paint sleeves
     
  37. FlightFight

    FlightFight

    Joined:
    May 29, 2017
    Posts:
    27
    Thanks for the reply John,
    good luck with merging Magica Cloth with the Rukhana ECS Animation system!
     
    Last edited: May 16, 2023
  38. FlightFight

    FlightFight

    Joined:
    May 29, 2017
    Posts:
    27
    @hoshos, is it possible to use Magica Cloth 2 from ECS 1.0 without having to deal with expensive GameObject-related operations?
    My use case would be to use Magica Cloth 2 for pieces of cloth dangling from hundreds of moving vehicles. The vehicles are using DOTS physics colliders (not Havok).

    Ideally I could use an ECS system to update the positions / rotations of the cloth pieces in relation to the vehicles without having to reposition GameObjects (changing the transforms of GameObjects would be too expensive).
     
    Last edited: May 16, 2023
  39. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    940
    Hello.
    This is most likely a bug.
    First of all, is the version of MagicaCloth the latest?
    Currently v2.1.2 is the latest.
    If it's outdated, try updating it first.

    And could you post the full text of the error?
    The error text is an important clue.
     
  40. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    940
    First, check if the collider is correctly registered in the collider list.
    Also, the mode of the collider panel must be other than [None].
    (usually Point mode)
    Please refer to the following documents.
    https://magicasoft.jp/en/mc2_magicacloth_collidercollision/
     
  41. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    940
    MagicaCloth does not yet support ECS.
    This is because ECS is not yet in general widespread use.
    Also, my lack of study.
    However, if ECS becomes popular in the future, we will naturally consider supporting it.
     
    FlightFight likes this.
  42. kuri_pl

    kuri_pl

    Joined:
    Jun 21, 2016
    Posts:
    4
    Hi, I'm very interested in this asset. But my problem is that I work mainly with WebGL, and the assets says it doesn't work with it... I'm wondering if there is a way or a trick to make it work someway with WebGL.
     
  43. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    940
    Hello.
    Unfortunately, there are no plans to support WebGL.
    This is a Unity engine issue, not a MagicaCloth issue.
    WebGL does not support Unity DOTS multithreaded behavior.
    Therefore, it will work, but it will be executed in a single thread and the performance will be very bad.
    This is not very practical.
    In the future, if Unity DOTS supports multithreading with WebGL, MagicaCloth will automatically work smoothly.
     
    kuri_pl likes this.
  44. Mayumichi

    Mayumichi

    Joined:
    Mar 12, 2017
    Posts:
    31
    Is there any way to move the Assets/MagicaCloth2 folder to somewhere else (like Assets/Plugins/MagicaCloth2)? If I do so with v2.1.2, the component doesn't work anymore and existing ones look like this

    upload_2023-5-17_14-51-28.png

    edit: After restarting the editor it can't find the script anymore
     
  45. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    940
    Hello.
    Placing MagicaCloth in the Plugins folder will not work.
    This is because Plugins is set as a special folder in Unity.
    Placing assets in the Plugins folder will switch the compilation order and assembly definition to Unity's own.
    As a result, MagicaCloth will not work.
    For more information, please search for Unity's Plugins folder specification.
     
    Mayumichi likes this.
  46. riccardo2812

    riccardo2812

    Joined:
    Oct 8, 2012
    Posts:
    17
    Hello,

    Is it possible to bake the cloth bones animation into a anim files for edit and reuse it, for make some optimization?

    Kind Regards
     
  47. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    940
    Hello.
    This can be difficult.
    MagicaCloth's simulation is executed just before rendering after LateUpdate().
    And at the start of the next frame the Transform's pose is reset.
    (Please understand that this reset process is absolutely necessary.)
    Therefore, even if you get the Transform posture with a normal Update() etc., you cannot get the posture after the simulation.
    The post-simulation Transform pose must be obtained immediately after the simulation is completed.
    The following OnPostSimulation event is useful for this.
    https://magicasoft.jp/en/mc2_api_magicamanager/#OnPostSimulation

    I think it's possible if the animation recording system can be linked well with this event, but I don't know for sure until I try it.
     
  48. doranikofu

    doranikofu

    Joined:
    Feb 12, 2021
    Posts:
    3
    this is the error text, seems to happen more often with high # of vertices

    errorId: Assert failed
    This Exception was thrown from a job compiled with Burst, which has limited exception support.
    0x00007ffce2540124 (a2243e26949c98685b1d3a7d40342f1) [unknown:0] Unity.Jobs.IJobParallelForExtensions.ParallelForJobStruct`1<MagicaCloth2.VirtualMeshManager.CalcTriangleNormalTangentJob>.Execute(ref MagicaCloth2.VirtualMeshManager.CalcTriangleNormalTangentJob jobData, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, ref Unity.Jobs.LowLevel.Unsafe.JobRanges ranges, int jobIndex) -> void_73c04fea4d034adcf3d7ccb459d2c985 from UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
    0x00007ffce253ba76 (a2243e26949c98685b1d3a7d40342f1) 1382d634b5f74bfc97ebcd70d86afe7d
    0x00007ff7dc208a50 (Unity) ExecuteJob
    0x00007ff7dc208dc5 (Unity) ExecuteJobCopyData
    0x00007ff7dc209acf (Unity) ForwardJobForEachToManaged
    0x00007ff7dc204d7c (Unity) JobQueue::Exec
    0x00007ff7dc2050ae (Unity) JobQueue::ExecuteJobFromHighPriorityStack
    0x00007ff7dc205784 (Unity) JobQueue::processJobs
    0x00007ff7dc20799f (Unity) JobQueue::WorkLoop
    0x00007ff7dc408627 (Unity) Thread::RunThreadWrapper
    0x00007ffd4cb27614 (KERNEL32) BaseThreadInitThunk
    0x00007ffd4eb226a1 (ntdll) RtlUserThreadStart
     
  49. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    940
    This bug has been fixed in the latest v2.1.2.
    Does it happen with the latest v2.1.2 as well?
     
  50. doranikofu

    doranikofu

    Joined:
    Feb 12, 2021
    Posts:
    3
    sorry yes 2.1.2 works fine now. I did not import the updated script so the bug still showed up in my project with v2.1.1.
     
    hoshos likes this.