Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

[RELEASED] Magica Cloth

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

  1. unwshd_elend

    unwshd_elend

    Joined:
    Mar 21, 2019
    Posts:
    23
    hello , I'm having a strange problem , when I load the scene for the first time everything is ok but next time I load the scene or a different scene , the whole simulation is broken. the only clue I found was in MagicaMeshCloth inspector where "Visible" and "Calculations" are both false after loading the scene for the second time.
     
  2. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    551
    Hello.
    Thank you for the information.
    Please see that this problem is complicated and another problem arises when the array is made variable length as explained earlier.
    However, I think your experimental results are correct, so I would like to consider if there is any improvement.
    For reference, can you just tell me how many specifications and arrangements of the terminal (PC?) You experimented with will cause a delay?

    (Example: This is the spec of my development PC)
    Windows PC
    CPU: AMD Ryzen 7 3700X 8core
    GPU: Nvidia GeForce2070 super
    RAM: 16GB
    Array Size: 100000-
     
  3. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    551
    Hello.
    Perhaps the MagicaPhysicsManager disappeared when I loaded another scene.
    Manager is set to Unity's DontDestroyOnLoad so that it will not disappear even if the scene changes.
    However, this function will not be enabled unless the Manager is placed at the top level of the scene.
    This is written at the bottom of the following document.
    https://magicasoft.jp/en/magica-cloth-physics-manager-2/

    For example, if Manager is a child of another GameObject, it will be deleted by moving the scene.
    Please check if there is a problem with this point.
     
    unwshd_elend likes this.
  4. unwshd_elend

    unwshd_elend

    Joined:
    Mar 21, 2019
    Posts:
    23
    That was exactly the problem , thanks !
     
    hoshos likes this.
  5. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    551
    Update: 1.12.4

    v1.12.4 has been released on the Asset Store!
    http://u3d.as/1Hzx

    Release Note:
    Note: The fast mesh write option [Faster Write] is turned off by default.
    This is due to problems such as the mesh breaking depending on the environment.
    We are currently investigating this matter.
    Fixed: Fixed an issue where the mesh would break at run time if there was a difference between the SkinnedMeshRenderer scale and the rootBone scale when creating the RenderDeformer.
    However, to solve this problem, you need to reconstruct the data by pressing the [Create] button of the corresponding Render Deformer.

    https://magicasoft.jp/en/release-note-2/
     
  6. CoolCat518

    CoolCat518

    Joined:
    Feb 4, 2015
    Posts:
    18
    Hi, I have used magica cloth for my character's clothes and hair, after I build these characters into asset bundle, when I read and create them, the effect of magica cloth is not working, the hair and clothes are not moving, and I have added a MagicaPhysicsManager to each character, it still does not work, how can I solve this problem?
    By the way, characters that are not packaged in an asset bundle are working properly
    Im using unity 2021.2.16
    upload_2022-3-23_11-33-11.png
     
  7. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    551
    Hello.
    Probably the post was posted in both the email and the forum, so I will reply to both.
    First of all, I have tested the use of Magica Cloth with the asset bundle (Addressable System), so it works fine.
    I also use Addressable System for testing.
    So there may be something wrong with the prefab.
    Please check the following two points.

    (1) Does the prefab have sub-assets?
    MagicaCloth data is stored in the prefab as a sub-asset.
    Therefore, if this sub-asset does not exist as in the image, the data is not stored correctly.
    prefab-subassets-1.jpg

    (2) Component confirmation in prefabricated mode
    Double-click on the appropriate prefab to enter prefab mode.
    So check the Magica Cloth components to see if there are any errors.

    If there is a problem with either (1) or (2), the data is not created correctly.
    In this case, press the [Create] button in the prefab mode to create the data, or create the data in the scene and save the data in the prefab again with Overrides / Apply All of Imspector.
     
  8. alchemist_wurzelpurzel

    alchemist_wurzelpurzel

    Joined:
    Sep 4, 2018
    Posts:
    35
    Hi!

    We are using Magica in combination with a Character Creation System with Unity 2020.3.17f1, URP 10.6.0 and Magica 1.12.1.

    We have several Magica ColliderComponents (mostly Capsules) in our Rig, so when the Player changes their pants for instance to a skirt, we add the ColliderComponents to the MagicaMeshCloth components on the new skirt via BaseClothAPI.AddCollider(). This works most of the time, but especially when quickly changing back and forth between different clothing pieces, sometimes the Colliders are not used at all.

    After some investigation I found out that this happens because the c.IsValid() check in BaseClothAPI line 107 fails. I think it fails because in ParticleComponent.CreateParticle() line 286 the teamId is already contained in the dictionary and thus a new ChunkData without any actual data is returned.

    Am I doing the Collider assignments wrong, am I missing something or could this be a bug on the Magica side?
     
    Last edited: Mar 28, 2022
  9. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    551
    Hello.
    Thank you for the detailed report!
    This may be a bug, so I'd like to review the code.
     
  10. ChrisCoool

    ChrisCoool

    Joined:
    Jul 3, 2017
    Posts:
    14
    Hi, is there any way to get an older version of Magica Cloth? Our project is based on Unity 2019.3.6 ...
     
  11. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    551
    Hello.
    If you want an older version, please contact support email or my InBox on this forum with the invoice number starting with IN on the purchase receipt PDF.
    Please tell us the version you want at that time.
    However, please note that we cannot basically support bug fixes other than the latest version.

    <support mail>
    support@magicasoft.jp
     
  12. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    551
    I'm investigating, but I still don't know the cause.
    Could you tell me about the following?

    (1) Use of global collider
    Is the IsGlobal flag on the collider that has the problem?

    (2) Value of teamId when a problem occurs
    Do you know the value of teamId when you have a problem and return on line 286 of ParticleComponent.CreateParticle ()?
    Is it non-zero?

    (3) Reuse of colliders
    Does the collider call the API of AddCollider () many times?
    So are you switching the same collider to different fabric components with AddCollider ()?

    (4) Use of RemoveCollider () API
    If possible, try removing the collider using the RemoveCollider () API before the cloth component is removed.
    RemoveCollider () is an API paired with AddCollider ().
    Does doing this solve the problem?
     
  13. alchemist_wurzelpurzel

    alchemist_wurzelpurzel

    Joined:
    Sep 4, 2018
    Posts:
    35
    We have internally postponed this issue due to time constraints but here is some more information:

    (1) The IsGlobal flag is not used on any of the colliders.

    (2) The value of teamId when the problem occurs is non-zero.

    (3) We have a total of 15 colliders that are all added via AddCollider() to a new Clothing piece. We are planning on reducing the amount used per Clothing piece since of course a Skirt does not need to use the collider for the Character's head.

    (4) I am not yet using RemoveCollider() to remove Colliders from a piece that is about to be replaced. I will try that once I get back to the issue!

    Some additional info:
    It only started happening once we added 2 Colliders for the Character's head. So there might still be something wrong with our code on that end.
    I will investigate (4) and give you an update once I know more.

    Thank you for your time!
     
    hoshos likes this.
  14. spakment

    spakment

    Joined:
    Dec 19, 2017
    Posts:
    68
    Hi, a pre-purchase question, does this work on IOS platforms?
    (eg, compiles fine with IL2CPP and through xcode)
     
  15. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    551
    Hello.
    Yes, MagicaCloth works fine on iOS.
    Basically, it can be used on all platforms except WebGL.
    However, since mobile devices including Android have a low number of CPU cores, it is necessary to be a little careful when using a large amount of MeshCloth.
    It consumes a lot of CPU resources to read and write the vertices of the mesh.
    There is no problem with BoneCloth.
     
  16. Mbastias

    Mbastias

    Joined:
    Jan 1, 2015
    Posts:
    6
    Hello, is there a way to make this work with the 2D animation package? I had the problem before where the bones move but the sprite doesn't (I'm guessing that's due to the moment Unity updates the sprites skin to be moved is either too soon or too late) or the sprite moves but flicker.
     
  17. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    551
    Hello.
    First of all, Magica Cloth has not been verified to work with 2D animation package.
    So I don't know if it works.
    And if something goes wrong, we have no plans to deal with it at this time.
    However, if you can report what kind of problem occurs, if the cause is simple, we may be able to deal with it.
     
  18. Mbastias

    Mbastias

    Joined:
    Jan 1, 2015
    Posts:
    6
    I'm not entirely sure what the problem is without looking at Magica Cloth's code, is probably a timing issue. I can show you what happens:

    This is with a BoneCloth with Update set as Normal. The bones move according to the parameters, so is almost working.


    This is with the Update set as Unity Physics. The sprite moves this time but it tries to go back to the initial position making it flicker.


    Edit: I took a look at the code. From what I can get Magica Cloth updates the bone position after the LateUpdate but the SpriteSkin of 2D Package does ON the LateUpdate. So I'm guessing for SpriteSkin the Bones never moved.

    Edit2: I embedded the packages and made the SpriteSkin update inside MagicaPhysicsManager.AfterLateUpdate. It works but I'm worried about performance, I'll try to disable the LateUpdate calls so it doesn't get made twice.
     
    Last edited: Apr 14, 2022
  19. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    551
    Thank you for the very easy-to-understand video.
    This seems to be a Magica Cloth update timing issue.
    By the way, the first setting is correct.
    The second [Unity Physics] mode is not correct here as it is used when the update mode of Animator is set to [Animate Physics].
    If it's an update timing issue, you may be able to fix it with a few adjustments.
    I'm going to investigate this issue.
    We will report the results on the forum, so please take a moment.
     
  20. Mbastias

    Mbastias

    Joined:
    Jan 1, 2015
    Posts:
    6
    As I said on my edit, I managed to get it working. I couldn't do it without changing 2D Animation code, because it was the only way I saw due to all the classes and functions being sealed or internal, and also to prevent the sprite update from happening more than needed. So I embedded(as in I made a local copy), both packages and made it so the update of SpriteSkinComposite happened inside the AfterLateUpdate(or PostLateUpdate) of MagicaPhysicsManager.
    Now, I know that means the skin is getting updated as many times as the physics, but, both systems are using Burst so performance seems to be ok, my game won't have too many physics enabled characters on the same scene anyways.

    Quick demo with bad rigging:


    Anyways, if you find a better way please let me know. I'm leaving a positive review soon!
     
  21. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    551
    Hello.
    The cause has been roughly identified.
    All sprite transformations in the 2D Animation Package seem to be done with LateUpdate ().
    However, the default update location for MagicaCloth is after LateUpdate (). (Red mark)
    In this case, nothing happens because the sprite has already been deformed.
    The solution is to update MagicaCloth before LateUpdate (). (Blue mark)

    2D_Animation-1.jpg

    I made an extension that allows you to choose the update location to fix this issue.
    This version will be v1.12.5.preview1.
    I'll send it to your [In Box] so can you test it?
     
  22. Alaadel

    Alaadel

    Joined:
    Apr 6, 2013
    Posts:
    23
    Hello,
    Thank you for the great addon!

    I am trying to make the pants move in a realistic way, but I always get "tearing" and the pants do not handle stretching well. I tried to make some points fixed, but that stops tearing in one part and create new tears in other parts.
    magica pants.png
    Is there any way to solve this?
    (Note: I am using magica colliders for the legs, and they behave correctly).

    Also, are there any presets for pants and shirts (i.e. male clothes other than Unity-chan's)?

    Thank you!
     
  23. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    551
    Hello.
    Costumes that stick to your body may be a little difficult, but the following settings may help.

    (1) Clamp Position
    You can limit the distance that particles can move from the origin by setting the Clamp Position.
    This avoids the problem that the clothes that are in close contact with each other are greatly displaced.
    https://magicasoft.jp/en/paramater-clamp-position-2/

    (2) Penetration
    You can limit the range in which particles can move by using the [Penetration] function.
    See the following guide for details.
    https://magicasoft.jp/en/prevent-penetration-2/

    As for presets, we do not have close-fitting clothes at this time because it is difficult to control.
    Thank you.
     
    Alaadel likes this.
  24. Alaadel

    Alaadel

    Joined:
    Apr 6, 2013
    Posts:
    23
    Thank you! I will try your suggestions.

    As you can see in the above picture, when the upper part of the pants (below the belt) is stretched, it breaks. Is there any way (using Magica or 3D Modelling) to make the cloth stretch normally without breaking?

    Thank you very much!
     
  25. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    551
    MagicaCloth does not have a tearing function, so basically it can stretch but not tear.
    Therefore, the cause is not well understood.
    Perhaps the original mesh triangle is already separated to the left and right.
    In that case, try creating a simulation mesh by increasing the value of the vertex reduction of VirtualDeformer a little.
    This will combine the closest vertices and eliminate the gap.
     
  26. Eden_fassker

    Eden_fassker

    Joined:
    Nov 4, 2021
    Posts:
    4
    Is mesh collider not applicable? It is necessary for realistic clothing expression. please...................
     
  27. homemacai

    homemacai

    Joined:
    Jul 22, 2020
    Posts:
    50
    Hello there! Noob question here, Is there any example on how to get the Attached Cloth GameObject using this method :

    public int AttachAvatarParts(GameObject avatarPartsPrefab, System.Action<GameObject> instanceAction = null)

    Not sure exaclty how to subscribe to that action when declared like that.
     
  28. Asarge

    Asarge

    Joined:
    Jun 2, 2018
    Posts:
    15
    When using the Mesh Cloth component which settings work best to achieve this result? Movement seems to simulate well but falling and hard landings where the force should be moving it more don't seem to function as expected. I've tried fiddling with certain parts but can't get it working too well, what section and values should I tweak?
     
  29. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    551
    Hello.
    Currently mesh colliders are not available.
    This is reserved because it is technically esoteric and not very practical in terms of performance.
    There are many requests for this, but we have no plans to implement it at this time.
     
  30. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    551
    Hello.
    I think the DressUpSample scene will be helpful for the dress-up API.
    It can be found in MagicaCloth / Example (Can be deleted) / Scene / DressUpSample.

    DressUpControl.cs is attached to the DressUpControl object in this scene.
    If you look at this script, the AttachAvatarParts API is used internally.
     
    homemacai likes this.
  31. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    551
    hello.
    Maybe the automatic reset is working.
    This will reset the simulation if the character moves abruptly.
    Usually used for teleporting.
    Check the World Influence panel as follows to see if Reset After Teleport is checked.

    https://magicasoft.jp/en/paramater-world-influence-2/

    If it is checked, try turning it off.
     
  32. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    551
    Update: 1.12.5

    v1.12.5 has been released on the Asset Store!
    http://u3d.as/1Hzx

    Added an option to the MagicaPhysicsManager component to change the location of simulation updates.
    Normally, the simulation is run after the Late Update, but you can select Before Late Update to run it before the Late Update.
    This is required when using 2D Animation Package etc.
    update-location-1.jpg

    Release Note:
    Note: MagicaCloth is now available in the 2D Animation Package.
    Added: Added an option to the MagicaPhysicsManager component to change the location of simulation updates.
    Normally, the simulation is run after the Late Update, but you can select Before Late Update to run it before the Late Update.
    This is required when using 2D Animation Package etc.
    Added: Added API to change Spring Power.
    Added: Added API to get a list of all registered MagicaCloth components.
    Improvement: In the Spring parameter inspector, numbers that cannot be changed during execution are grayed out and cannot be manipulated.

    https://magicasoft.jp/en/release-note-2/
     
  33. jnbbender

    jnbbender

    Joined:
    May 25, 2017
    Posts:
    453
    Just got this package and it is DEFINITELY easy to work with than Unity Cloth. I am having one issue I can't seem to solve, there are just so many parameters. My character wears a cloak and it is just too light. How do I make it heavier so it doesn't move as easily. When my character comes down from a jump it is so light it can flip to the side. I probably need to add more fixed points but just not sure. Any ideas?
     
  34. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    551
    Hello.
    If the simulation is significantly disturbed when moving, reducing the effect of the movement on the cloth may help to stabilize it.
    To do this, adjust the World Influence parameter.
    For details, refer to the following manual.
    https://magicasoft.jp/en/paramater-world-influence-2/
     
  35. Eden_fassker

    Eden_fassker

    Joined:
    Nov 4, 2021
    Posts:
    4
    Is it possible to simulate according to the movement of the avatar even without "Skinned mesh"?
     
  36. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    551
    Hello.
    Magica Cloth has Bone Cloth.
    It cloth-simulates a Transform like a Dynamic Bone.
    Skinned Mesh is not needed in this case.
    https://magicasoft.jp/en/bonecloth-start-2/
     
  37. bmceldowney

    bmceldowney

    Joined:
    Jul 13, 2017
    Posts:
    3
    Hello,
    I just purchased MagicaCloth in the recent asset sale and have been following along with the setup instructions for the MeshCloth/MeshSpring. When I add the MagicaRenderDeformer to my object it shows Active, Visible and Calculation as all false:
    Screenshot 2022-04-27 202224.png

    Nothing that I do changes this and I don't get any gizmos showing up in the scene view. Is there something that I am missing?

    Thanks!
     
  38. bmceldowney

    bmceldowney

    Joined:
    Jul 13, 2017
    Posts:
    3
    Looks like everything is working, I just didn't realize that the project needed to be running in order for the deformer to show as active. The only thing that I can't figure out now is why I can't see any gizmos in the editor. I have them all turned on, but they won't show up.
     
  39. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    551
    Hello.
    Yes, it's correct.
    Active / Visible / Calculation is the run-time status, which is false before execution.
    And you need to start ClothMonitor to see the gizmo.

    https://magicasoft.jp/en/magica-cloth-cloth-monitor-2/

    If you don't see the gizmo when you start Cloth Monitor, please let me know.
     
  40. bmceldowney

    bmceldowney

    Joined:
    Jul 13, 2017
    Posts:
    3
    Everything is working great, thanks!

    This is a great asset! One question though, do you plan on adding collider support for Bone Springs?
     
  41. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    551
    I was relieved that the problem was resolved.
    There are currently no plans for Bone Spring colliders.
    This is easy to add, but it didn't work very well in my experiments.
    However, there are many requests, so I would like to study again.
     
  42. Eden_fassker

    Eden_fassker

    Joined:
    Nov 4, 2021
    Posts:
    4
    Is there any solution to the problem of increasing the texture of clothes during simulation?
    It looks like the picture when the avatar raises its arm.
     

    Attached Files:

    • a.PNG
      a.PNG
      File size:
      808.6 KB
      Views:
      152
  43. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    551
    Hello.
    I'm sorry, I'm not sure what the problem is with this image alone.
    Could you tell me a little more about it?
    It would be helpful if there were other images.
     
  44. Eden_fassker

    Eden_fassker

    Joined:
    Nov 4, 2021
    Posts:
    4
    The avatar's movement distorts or stretches the textures of the checked clothes.
    I'm sorry that I couldn't upload it due to project security.
     
  45. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    551
    MeshCloth uses a virtual mesh called Virtual Mesh to perform its own skinning process, so it may be slightly distorted due to movement.
    It is also possible that there is some calculation problem specific to the relevant mesh.
    At present, it is difficult to give advice because the movement cannot be confirmed, but please test the following.

    (1) Virtual Deformer settings
    https://magicasoft.jp/en/magica-cloth-virtual-deformer-2/
    You can adjust the distribution of skinning vertex weights by changing the Weight Pow.
    This may improve the quality of skinning.
    Do not lower [Max Weight Count] from 4.

    (2) Clamp Position
    https://magicasoft.jp/en/paramater-clamp-position-2/
    If the particles move violently, the triangle may fold and the distortion may increase.
    Therefore, you can set the Clamp Position parameter to limit the distance the particles travel from their original vertex position.
     
  46. alexis_unity198

    alexis_unity198

    Joined:
    Jul 7, 2020
    Posts:
    1
    Hello! I read earlier in the thread that there were plans to add a box collider. Is that still going to happen? I'm setting up collisions between capes and tails right now, and some of the tails I'm trying to collide with are wide and flat, like bird feathers, and capsule colliders aren't giving me a very good result right now. We're currently using v1.12.4
     
  47. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    551
    Sorry, the box collider has not been added yet.
    Box colliders are difficult to implement and are pending.
    At the moment, the only way is to arrange multiple spheres or capsules side by side and treat them as a plane.
    I haven't forgotten the story of the box collider, so I'd like to experiment again somewhere.
     
  48. TaylorCaudle

    TaylorCaudle

    Joined:
    Feb 8, 2018
    Posts:
    134
    Hey there, im thinking of switching from DynamicBones to this asset, since DynamicBones are giving me crazy bad performance on scenes with large amounts of NPCs at one time- 25-50, and was wondering how this might perform in a a setting like that.

    Have you done any tests on multiple characters using bones like this? My characters currently have anywhere from 40-50 DynamicBones each, for hair and clothing, and I'm trying to find a way to optimize it so i dont lose 30-60 frames by having them in the scene.
     
  49. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    551
    Hello.
    MagicaCloth is designed for high performance when used on a large number of characters.
    The following video is an example of setting Magica Cloth to 50 characters.
    There are 3 BoneCloths, 1 MeshCloth, and 2 MeshSprings for each body.


    Also, as you can see in the video, Magica Cloth has a culling system.
    By using this system, characters outside the screen can stop the simulation and reduce the load.
    https://magicasoft.jp/en/cullingsystem/

    In addition, Magica Cloth has a deferred execution system.
    Turning on deferred execution allows the simulation to run during rendering, further improving performance.
    https://magicasoft.jp/en/magica-cloth-physics-manager-2/
     
  50. TaylorCaudle

    TaylorCaudle

    Joined:
    Feb 8, 2018
    Posts:
    134
    awesome, thanks!
    I picked this up a while back, I'll give this a shot!