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:
    942
    Hello.
    Unfortunately there is no progress yet.
     
  2. snipercat9

    snipercat9

    Joined:
    Feb 19, 2024
    Posts:
    3
    I don't think it's a magicaCloth problem right now because meshcloth is supposed to apply a lot of blendshap, but right now unity and visionOS don't support blendshape.After half a year of urging, unity has already included blendshape in the roadmap , if there is a demand I suggest you urge, unity&Apple
     
  3. Bwacky

    Bwacky

    Joined:
    Nov 2, 2016
    Posts:
    211
    Can Magica Cloth 2 work with objects like flags and fabric? I can't seem to get it working no matter what I try.
    I am on the latest version and I want to use it instead of Unity's cloth component since Magica will be probably faster, but I can't get to testing since the objects I use never move.

    Here is an example video, I have a flag that I want to animate with the wind. It has the same settings as the character but the cloth is not moving.

    https://www.dropbox.com/scl/fi/hlqa...k0x.webm?rlkey=jcd6dao0lfj2nqnvod1wwa8qj&dl=0

    I tried bone cloth, mesh cloth, and bone spring, setting the root to both the flag_01 parent and directly to the fabric item. I tried skinned mesh renderer, mesh renderer, the object is not static. Don't know what else I can try. Nothing works, think I tried almost everything I could think of by now. If you could give some advice or add example static objects to the demo package we could learn from that would be great.
     
  4. Game-Dragon

    Game-Dragon

    Joined:
    Nov 16, 2012
    Posts:
    39
    I'm trying to use Magica Cloth 2 for buttocks physics using Bone Spring, but I don't think I have the set up right. I'd like the leg and everything down the bone chain to be completely still and just animate the bones marked in green. But this currently makes the entire leg jiggle.

    upload_2024-4-13_18-25-21.png
     
    Last edited: Apr 13, 2024
  5. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    942
    Hello.
    Yes, MagicaCloth can also be used for regular flags, etc.
    However, it is a little weak because it is optimized for human clothing.

    I watched the video.
    I don't understand why this flag doesn't move at all.
    There seems to be a problem with the settings.
    Can you provide this project?
    Please send me a DM if possible.
    You can start DM from "Start a Conversation" on my account.
     
  6. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    942
    Hello.
    In this case, the red Transform will move.
    Remove the red Transform and set the green Transform as the root.
    In order to create more realistic movement, it would be a good idea to add a new Transform for the pendulum.
    This is expressed as an image as follows.
    New routes and fixed attributes are in red.
    Transform for pendulum with green color newly added.
    Black Transform is not used.
    bonespring-1.jpg
     
  7. Game-Dragon

    Game-Dragon

    Joined:
    Nov 16, 2012
    Posts:
    39
    That worked perfectly. Thank you!
     
  8. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    942
  9. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    942
    Update:2.7.0

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

    An inertia smoothing function has been added, which can alleviate problems such as sudden starts and stops that disrupt the simulation.



    Release Note:
    Added: Added inertia smoothing function. It is possible to reduce the disturbance of the cloth due to sudden movement. It can be adjusted with the "World Inertia Smoothing" parameter in the inertia panel.
    mc2_10_inertia-2.jpg
    Added: Added AnimatorLinkage to UpdateMode. Automatically sets the appropriate update mode in conjunction with the character's Animator.
    mc2_10_updatemode-1.jpg
    Fixed: Fixed an issue where assert logs were displayed when a component was destroyed during runtime build initialization. Note that this assertion has no effect on operation.
    Improvement: Adjusted the inertial smoothing parameters of UnityChanKAGURA.
    Improvement: Adjusted inertial smoothing parameters for each preset.
    Improvement: Changed UpdateMode of sample UnityChanKAGURA to AnimatorLinkage.

    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
     
  10. RabberDakk

    RabberDakk

    Joined:
    Feb 23, 2019
    Posts:
    14
    Any progress on Tangent update mode?

    I'm not rushing you. If you need shader that uses tangent and project that uses it, please contact me. I'll make it using open source only and send it to you.
     
  11. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    942
    Hello.
    I haven't worked on the tangents yet.
    Please wait a little longer.
    Also, it would be great if you could provide a project where I can test the tangents.
    Please do so!
     
  12. RabberDakk

    RabberDakk

    Joined:
    Feb 23, 2019
    Posts:
    14
    When tested it, got weird results...
    I checked magicacloth1 and magicacloth2 with shader that uses tangent.
    Refs: https://zhuanlan.zhihu.com/p/107664564
    1. this shader + magicacloth1 (mesh cloth + update normal) = outline is broken
    2. this shader + magicacloth1 (mesh cloth + update normal and tangent) = outline is NOT broken
    3. this shader + magicacloth2 (mesh cloth) = outline is NOT broken
    In every case, I deform the mesh almost as much (maximize Gravity and disable Angle Restoration). But after deforming the mesh with magicacloth2, the outline is still displayed correctly when using tangent. Also the problem I reported at the end of 2023 also cannot be reproduced now. Maybe I misunderstood something at that time...?

    Can anyone reproduce the situation where the outline breaks with magicacloth2 meshcloth and the smooth normal outline method?

    Unity 2022.3.21f1 | MagicaCloth1.12.13 | MagicaCloth2.7.0
     
    Last edited: Apr 16, 2024
  13. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    942
    This result is strange.
    Normal calculation for V2 is basically the same as V1.
    However, since it was completely rewritten, there may have been some changes.
    Also, V2 had a problem with normal calculation.
    This has been fixed in v2.1.7.
    https://magicasoft.jp/en/mc2_releasenote/

    This may be a factor.
     
  14. RabberDakk

    RabberDakk

    Joined:
    Feb 23, 2019
    Posts:
    14
    I've finally discovered a case where the reproducible outline breaks. In MagicaCloth2 version 2.7.0. Disabling MeshCloth will make the outlines correct. During the investigation, I ended up using a lot of NDA shader code, so it might take some time to rewrite the project.
     
  15. ciathyza

    ciathyza

    Joined:
    Aug 16, 2015
    Posts:
    116
    Hi,
    did anyone have success with getting breast physics working with this and Character Creator 3/4 characters?
    No matter what I'm setting this to the result is zero physics. I noticed the relevant bones on CC characters are very far front but I'd image that at least some physics should apply and be visible, but I get none. Anyone know how to get this working?
     
    Last edited: Apr 23, 2024
  16. wechat_os_Qy01Clc1a-n6lbMBoILatSp6w

    wechat_os_Qy01Clc1a-n6lbMBoILatSp6w

    Joined:
    Oct 6, 2022
    Posts:
    29
    Hello? For example, if I use five MagicaCloth components on my character, do I need to add a MagicaSettings component to each object with a MagicaCloth component to change its frequency, or do I just need to add MagicaSettings to any component of the same scene to work for all MagicaCloths。
     
  17. wechat_os_Qy01Clc1a-n6lbMBoILatSp6w

    wechat_os_Qy01Clc1a-n6lbMBoILatSp6w

    Joined:
    Oct 6, 2022
    Posts:
    29
    Hello! Great creator. Does the latest version contain possible fixes for the following issues, tried the Magica Cloth2 2.52 version. In the editor, there is a bug that the entire cloth of the game character disappears directly, and if you directly restart the Magica Cloth component at this time, the cloth will be displayed normally. Due to this issue, I had to revert to Magica Cloth2 2.42, but I used Magica Cloth2 2.42 to enable the Max Distance curve in the Movement Limit component on iPhone 12 ProMax. The performance degradation is extremely severe, and the performance returns to normal when the curve is turned off, but if the curve is not turned on, part of the fabric will be lifted due to the fact that the collider shape itself is a capsule.
     
  18. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    942
    Hello.
    What components do you use?
    Is it BoneCloth or BoneSpring?
    Also, do you have any images that show the structure of this character's bones and how they are set up?
     
  19. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    942
    Hello.
    The frequency is one for the entire system.
    Therefore, it is not possible to change the frequency for each component.
    MagicaSettings changes system-wide settings.
    Therefore, there is no point in placing more than one.
     
  20. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    942
    There was a fatal performance issue in v2.5.2.
    I'm not sure if this is the cause, but please update to the latest version if possible.
    The current latest version is v2.7.0.
    If you have the same issue with v2.7.0, please let me know.
     
  21. ciathyza

    ciathyza

    Joined:
    Aug 16, 2015
    Posts:
    116
    Thank you for replying! I'm trying to use BoneSpring. I haven't tried BoneCloth yet with this character which I guess would probably work but BoneSpring is better for performance.

    Here are some images:


    snag_20240423_0000.jpg snag_20240423_0001.jpg

    ... The bone position is default as per Character Creator export. I did not move them.

    As for components, there's nothing exotic. I'm using Opsive Ultimate Character Controller for the character control...

    snag_20240423_0003.png snag_20240423_0002.png

    EDIT: So I've set up the character in a more simple scene without all the character controller setup and the breast physics works! So it must be something from UCC that's interfering with it. I'm going to have a closer look to figure out what it is.
     
    Last edited: Apr 23, 2024
  22. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    942
    Thank you for the image.
    Does UCC mean CharacterCreator?
    Isn't there some special constraint component attached to the chest bone due to UCC?
    It seems that some component is interfering with CC_Base_L_RibsTwist/CC_Base_R_RibsTwist.
     
  23. vcasas

    vcasas

    Joined:
    Oct 6, 2017
    Posts:
    7
    Hi, i can use this tool for use in runtime(android/ios) and save the changes/updates of the cloth?
     
  24. ciathyza

    ciathyza

    Joined:
    Aug 16, 2015
    Posts:
    116
    by UCC I mean Ultimate Character Controller. Yes, something is interfering. It seems not to be the rigid body and I have yet to find what causes this.
     
  25. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    942
    Hello.
    No, unfortunately not.
    The running state cannot be saved.
     
  26. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    942
    Thank you for your reply.
    I don't know much about UCC, so I can't give you any further advice.
    Please contact the UCC author.
    If you can't figure out the cause, please provide the project.
    If there is a project that causes the problem, it may be possible to analyze it.
     
  27. Hazneliel

    Hazneliel

    Joined:
    Nov 14, 2013
    Posts:
    308
    Hello
    I am having a very strange issue with Magica Cloth 2.7

    I attach some SkinnedMeshRenderer cloth at runtime, the character that is having the cloth attached has an Animator component that is enabled.
    All works well if I spawn and attach some clothing like this, however if before attaching the clothing I manually or by script disable and re-enable the Animator component on the character, next time I attach the cloth Magica cloth will not work well and cloth willl look as if some vertex are fix.

    upload_2024-4-26_0-8-21.png
    upload_2024-4-26_0-8-52.png

    So in short:
    1- Disable and Re enable the Animator on a character
    2- Instantiate and attach a skinnedMeshRenderer that has Magica Cloth

    I appreciate any help.
     
    ZhavShaw likes this.
  28. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    942
    Hello.
    This is probably a character pose issue.
    MagicaCloth requires you to attach MagicaCloth at runtime with the same pose as when editing.
    Failure to do so may cause misalignment of various data and cause malfunctions.
    If this is the cause of your problem, there are three solutions:

    (1)
    The pose may have been affected by turning the Animator on/off.
    Try to avoid disabling Animator if possible.

    (2)
    Try using the MagicaSettings component and changing the initialization location from Start to Awake.
    https://magicasoft.jp/en/mc2_settings_component/

    (3)
    You may be able to resolve this issue by using the pre-built feature.
    MagicaCloth creates various data necessary for simulation at runtime.
    For this reason, the pose must be the same as when editing when initializing.
    However, with pre-construction, initialization processing is completed at the time of editing and it is stored as data.
    Therefore, it doesn't matter what pose the character is in at runtime.
    The documentation is as follows:
    https://magicasoft.jp/mc2_prebuild_setup/
     
  29. Hazneliel

    Hazneliel

    Joined:
    Nov 14, 2013
    Posts:
    308
    Thanks.

    1. I need to be able to disable/enable the animator in the character before adding a cloth that has Magica
    2. Tried the MagicaSettings with initialization location set to Awake but this made things worse.
    3. I tried to use the pre-build but when this is done, attaching the cloth to the new skeleton wont work anymore.

    We believe 3rd option is still the way to go, however we cannot figure out why bone transfering is not working when using this option.

    Hoping you can help us with this.
    Regards
     
  30. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    942
    Thank you for your reply.
    The problem this time may be different from what I imagined.
    I'm not sure what's causing the problem.
    I would like to directly investigate this issue. Can you provide a project?
    If possible, please send a DM from "Start a Conversation" on my account.
     
  31. ZhavShaw

    ZhavShaw

    Joined:
    Aug 12, 2013
    Posts:
    176
    I believe I may be having the same issue. In my case, it seemingly only occurs whenever I manually reassign the SkinnedMeshRenderer's bones.

    https://nyc3.digitaloceanspaces.com/teamparty/ShareX/2024/04/Unity_CZ7LyHTalt.mp4
     
  32. Hazneliel

    Hazneliel

    Joined:
    Nov 14, 2013
    Posts:
    308
    Thanks.
    As I was preparing the sample project I discovered a few interesting things and figured out a solution. I need to call animator.Rebind() whenever transfering bones to the cloth and the MagicaCloth.

    I still dont understand a few things but as I prepare a test project to illustrate I will let you know.

    I have another question thought, How can I set vertex weights? Right now is just move or not move which causes very weird shapes as there is no smooth transition between moving and not moving parts of a dress
    upload_2024-4-29_12-9-37.png

    I would like to paint smooth weights so that there is a smooth transition between moving and non moving vertex.

    I appreciate your help.
     
  33. SOL3BREAKER

    SOL3BREAKER

    Joined:
    Oct 11, 2021
    Posts:
    45
    Sir, I am using vroid, and I added 2 dresses to that character. They were the same template with same structure but use different bones, so the inner one would go through the outter one when using bone dress. I wonder if it could skip the simulate of inner dress and sync the position and rotation by the outer dress
     
  34. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    942
    Hello.
    I watched the video.
    Does this use the dress-up function?
    If you replace the bones of SkinnedMeshRenderer, you will also need to replace the bones of MagicaCloth for the same purpose.
    https://magicasoft.jp/en/mc2_dressup/

    Why is RootBone set to (None)?
     
  35. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    942
    Thanks, I'll wait for the test project.

    In MagicaCloth, vertex weights are automatically calculated.
    In MagicaCloth, this is called depth, and the strength of the parameter can be changed based on this depth value.
    See the following documentation for this:
    https://magicasoft.jp/en/mc2_baseline/
     
  36. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    942
    Hello.
    I'm sorry, but I don't understand the situation.
    I would like an image or video demonstrating this problem.
     
  37. TAIYOUSUN

    TAIYOUSUN

    Joined:
    Jul 4, 2016
    Posts:
    1
    Hi, I have a question for this asset.
    Is it possible to grab vertexes on cloth?
    As far as I checkd the load map of this asset, official support have mentioned the function I said wil be implemented.
    However, I'm not sure how to do this. It's not implemented yet?
     
  38. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    942
    Hello.
    There is no ability to grab cloth yet.
    A roadmap is a list of features planned for implementation.
    We will try to implement the features on the roadmap as much as possible, but development may be canceled due to various circumstances.
    Please understand this point.
     
  39. ZhavShaw

    ZhavShaw

    Joined:
    Aug 12, 2013
    Posts:
    176
    Thanks, that documentation fixed it.
    Is there another way to set the ColliderComponent List at runtime?
     
    Last edited: May 1, 2024
  40. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    942
    I was relieved that the problem was resolved.
    To change collider or parameters at runtime, you must call SetParameterChange() after making changes.
    Please refer to the following documents for more information:
    https://magicasoft.jp/en/mc2_runtimechanges/
     
    ZhavShaw likes this.
  41. ZhavShaw

    ZhavShaw

    Joined:
    Aug 12, 2013
    Posts:
    176
    Thanks!
     
  42. DrMeatball

    DrMeatball

    Joined:
    Nov 21, 2021
    Posts:
    115
    I need some help. I've had Cloth 2 working perfectly in the past, but I had to remake my character and now things aren't working. It could easily be something on my end that I'm just not remembering to do, but I'm at a loss for what's wrong.

    Here's the issue (not the collision part way through, i'll fix that later). Not even sure how to describe it other than the hair exploding / freaking out. It's mostly fine until the character moves.



    Screenshot 2024-05-04 171506.png
     
  43. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    942
    Hello.
    Thank you for the image.
    I'm concerned that the gravity is 0, but there seems to be no problem with the parameters.
    This is probably a problem with vertex painting.
    Open the vertex paint screen and check if you have forgotten to paint.
    I would also like to see a screenshot of vertex painting.
     
  44. wechat_os_Qy01Clc1a-n6lbMBoILatSp6w

    wechat_os_Qy01Clc1a-n6lbMBoILatSp6w

    Joined:
    Oct 6, 2022
    Posts:
    29
    Tested the latest 2.7 version, the performance problem still exists on iOS, the heating is extremely serious, especially the iPhone 12 ProMax CPU usage even reached 400% at some moments, of course this is due to Unity jobs, the type used is Mesh Cloth, the problem is if we don't enable the Max Distance curve in the Movement Limit component, then the performance can return to normal, and the CPU utilization rate is about 150%, which is an acceptable range.
     
  45. wechat_os_Qy01Clc1a-n6lbMBoILatSp6w

    wechat_os_Qy01Clc1a-n6lbMBoILatSp6w

    Joined:
    Oct 6, 2022
    Posts:
    29
    This problem is very tricky for me, if you don't turn on Max Distance curve, then the solution is unacceptable, because the collider does not fit perfectly with the body, resulting in some clothes being jacked up. But after turning it on, it has a very serious performance overhead on iOS, the phone is hot to the touch, and I also use pre-built, but it doesn't help much for performance, Android doesn't have such performance problems. Your help is urgently needed!
     
  46. wechat_os_Qy01Clc1a-n6lbMBoILatSp6w

    wechat_os_Qy01Clc1a-n6lbMBoILatSp6w

    Joined:
    Oct 6, 2022
    Posts:
    29
    And in operation, Magica doesn't have any errors, I checked the logs, and it's working.
     
  47. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    942
    Hello.
    Mobile devices have a limited number of CPU cores that can be used, which can be a problem.
    The iPhone 12 ProMax has 6 cores, but the actual number of cores that can be used as a job system is lower.
    For example, if the job system can only use 2 out of 6 cores, performance will not improve much.
    Please refer to the following documents for more information:
    https://magicasoft.jp/en/mc2_performance/

    However, it is strange that the performance changes greatly depending on the presence or absence of MaxDistance.
    This is because MaxDistance does not perform very expensive calculations.
    Please answer the following questions to analyze this issue.

    (1)
    How many vertices does the rendering mesh use in MeshCloth?
    Do you have more than tens of thousands of vertices?

    (2)
    Look at the status information displayed at the top of the inspector while MeshCloth is running.
    What is the number of vertices of [ProxyMesh] displayed here?
    This is the actual number of vertices simulated

    (3)
    I would like information on the actual profiler.
    Build and run on iPhone12ProMax with Debug build and AutoConnectProfiler enabled.
    Then, please save the profiler on the actual device as a file and provide it.
    You can save from the disk mark on the top right of the profiler screen.
    Also, please tell me the version of Unity editor you are using.
     
  48. wechat_os_Qy01Clc1a-n6lbMBoILatSp6w

    wechat_os_Qy01Clc1a-n6lbMBoILatSp6w

    Joined:
    Oct 6, 2022
    Posts:
    29
    The number of vertices of the mesh is 4k, and the number of triangles is 6k. I'm using the version of the Unity editor 2021.3.18, and in the xcode performance monitor, I see that the Unity job system uses four cores to execute the job, which should be a normal number of cores on mobile. The biggest factor that really affects performance is the use of Max Distance curves, not the Max Distance switch. As long as this curve is used, the performance will be consumed exponentially. I'm not building the ios installation package directly from Unity, but embedding Unity Framwork into the native iOS, and I can only provide the xcode analysis file here, not the Unity Profiler report.
     
  49. wechat_os_Qy01Clc1a-n6lbMBoILatSp6w

    wechat_os_Qy01Clc1a-n6lbMBoILatSp6w

    Joined:
    Oct 6, 2022
    Posts:
    29
    Some of these enable and disable solved analysis screen recordings
     
  50. wechat_os_Qy01Clc1a-n6lbMBoILatSp6w

    wechat_os_Qy01Clc1a-n6lbMBoILatSp6w

    Joined:
    Oct 6, 2022
    Posts:
    29
    upload_2024-5-7_11-38-6.png Previously, we didn't use MaxDIstence curves, which worked well on iOS devices and were acceptable for heat, which is not a problem on Android, with or without curves.