Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

[RELEASED] Magica Cloth

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

  1. Jiinzu

    Jiinzu

    Joined:
    Jan 18, 2019
    Posts:
    6
    hi first time i use magika cloth in unity 2020.3 and i have lot of probleme see :
     

    Attached Files:

  2. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Hello.
    Probably because the required packages are not installed.
    Try installing the [Burst] and [Jobs] packages according to the following installation guide.
    If the version is old, please try to update it.

    https://magicasoft.jp/en/magica-cloth-install-2/
     
  3. Jiinzu

    Jiinzu

    Joined:
    Jan 18, 2019
    Posts:
    6
    thx for answer now i have another probleme whene i load skirt preset i cant click on the button create to create data the button is not activated
     
  4. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Hello.
    Perhaps the vertex selection remains open as shown in the image.
    start-11.jpg
    Try pressing [End] or [Cancel] to finish the vertex selection.

    If not for the above reasons, is there any error message in the Inspector?
     
  5. athert

    athert

    Joined:
    Dec 31, 2012
    Posts:
    24
    Hello.
    I noticed that magica is taking cca 5ms in my build so i tried to change update mode to delay unscaled time but then - for some reason - it jump up to cca 15ms and this is how it looks in profiler. Is this normal behavior or do you think there can be bug somewhere?

    upload_2021-4-2_18-44-33.png
     
  6. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Hello. Please forgive me for not being able to answer in detail because I am moving now. First, burst from the menu Can you check if the compiler is enabled? You can find the item somewhere in the menu.
     
  7. athert

    athert

    Joined:
    Dec 31, 2012
    Posts:
    24
    Heya. Yes Burst should be enabled.
    For additional info, i have character with 2x MagicaMeshCloth, MagicaBoneCloth and MagicaBoneSpring (different part of body/clothing). I noticed that sometimes magica is low as 2ms and sometimes it jumps up to 10ms (difference is always only after editor/gameMode change. Not during play itself).
    Also, good luck with moving! :D
    upload_2021-4-3_1-22-10.png
     
  8. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    94
    Hello @hoshos, I'm really enjoying Magica cloth and finding it very good for my project. I'm having a bit of issue with the ReplaceComponentBone() method. Is there a script example of how to use this? I'm unable to use GetComponent() to access the RenderMeshDeformer and am unsure how this is done.

    Specifically I'm unsure how to access the original bone data as outlined in https://magicasoft.jp/en/corecomponent-2/

    I tried using the MagicaAvatar system but it wasn't really working well with my current swappable system. Thank you.
     
  9. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Hello.
    Thank you, you have successfully moved.

    It may have taken 10ms to initialize the game when it started.
    If this problem becomes noticeable, please contact us.

    <About performance>
    It is running in safe mode when running in Burst's editor.
    It will also be slower as we are also collecting profilers.
    By actually building it, the speed will increase several times.
    So it's currently 2ms in the editor, but it should be much faster at build time.

    <Delayed execution>
    If you are still concerned about performance, there is a "delayed execution" mode.
    https://magicasoft.jp/en/magica-cloth-physics-manager-2/
    This mode significantly improves performance because the simulation is done during rendering.
    However, clipping may be noticeable because the result is delayed by one frame.
    Magica Cloth covers this issue with "Future Prediction".
     
  10. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Hello.
    Sorry for the late reply due to the move.
    First of all, unfortunately there is no sample scene for ReplaceComponentBone ().
    Currently only the following documents are available.
    https://magicasoft.jp/en/corecomponent-2/

    All Magica Cloth components have class names with Magica as follows.
    MagicaRendereDeformer
    MagicaVirtualDeformer
    MagicaBoneCloth
    MagicaMeshCloth
    MagicaBoneSpring
    MagicaMeshSpring

    Therefore, you can get it by doing GetComponent () with the above class name.
    Also, all Magica components inherit from the CoreComponent class.
    Therefore, it is also possible to get all with GetComponentsInChildren () etc. and replaceComponentBone ().

    Does this solve the problem?
     
    Noogy likes this.
  11. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    94
    Thank you, that did help. At first I was having trouble with the fabric stretching uncontrollably but found out it was because my attached object wasn't sharing the same position as the source. Below is my method, it seems to work but if there's a cleaner solution I'm open to it.

    I'm iterating through all the bones in source and target skinned meshes and adding them to the dictionary. I had to make VirtualMeshDeformrer.cs/bonelist public for this.

    Code (CSharp):
    1.             MagicaVirtualDeformer[] vDeformer = sourceRenderer.GetComponentsInChildren<MagicaVirtualDeformer>();
    2.  
    3.             if (vDeformer != null)
    4.                 for (int v = 0; v < vDeformer.Length; v++)
    5.                 {
    6.                     Dictionary<Transform, Transform> boneReplaceDict = new Dictionary<Transform, Transform>();
    7.                     for (int vb = 0; vb < vDeformer[v].Deformer.boneList.Count; vb++)
    8.                         for (int sb = 0; sb < sourceRenderer.bones.Length; sb++)
    9.                             if (sourceRenderer.bones[sb].name == vDeformer[v].Deformer.boneList[vb].name)
    10.                                 boneReplaceDict.Add(vDeformer[v].Deformer.boneList[vb], sourceRenderer.bones[sb]);
    11.  
    12.                     vDeformer[v].ReplaceComponentBone(boneReplaceDict);
    13.                 }
     
    Last edited: Apr 7, 2021
  12. athert

    athert

    Joined:
    Dec 31, 2012
    Posts:
    24
    @hoshos heya.
    Im aware that editor/game can have different results in profiling, yet my issues is presented in both. In editor and even in game, it takes cca 5ms just for magica (i can show you different screens from profiling dev. build but you will see similar thing to what i posted).
    Also you mentioned i should try delayed execution but thats what im talking about. I have 5ms with "one per frame" but when i use delayed execution, it jumps up to 15ms, as is visible on screen i posted here.
    I tried few tests because i was wondering if i can speed it up on my side and i noticed that there is no difference between activated/deactivated magica component. Its still calculating even if its disabled (im not talking about manager). I tried to look at different Jobs in magica and i was not able to find anything related to component enable or checking if blend values (distance disable) are bellow certain value.
    When i added simple blend "ifs" to all magica jobs that was visible in profiler, they drop from for example 0.75ms to just 0.13ms. Is it something missing in jobs?
     
  13. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Hello.
    I think there is no problem with the source code.
    As you pointed out, <boneList> is currently set to private.
    Therefore, I would like to add an API that can get the list of Transforms referenced by each component.
    It will probably be available in the next version, so you will be able to use that API in the future.
     
    Noogy likes this.
  14. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    I'm sorry, I was a little misunderstood.
    I now understand that it is a performance issue during deferred execution.
    Could you please give me the following information to understand the problem?

    (1) MagicaPhysicsManager settings
    What is the manager's "Update Per Seccond" set to?

    (2) Cloth Monitor values
    Could you give me a screenshot of the running Cloth Monitor?
    This is an example of an image.
    clothmonitor-1.jpg
     
  15. athert

    athert

    Joined:
    Dec 31, 2012
    Posts:
    24
    Heya, i hope i have it everything visible on screens. I created two screes with "Once per frame" and second with "Delay unscaled time" :D
    upload_2021-4-8_18-44-41.png

    upload_2021-4-8_18-45-6.png
     
  16. athert

    athert

    Joined:
    Dec 31, 2012
    Posts:
    24
    Just to show as much data as possible, i also build game and make screenshot of debugger. You can see, there is still cca 5ms take from magica upload_2021-4-8_22-36-6.png
     
  17. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Thank you for the detailed information.
    I tried to analyze your profiler.

    Looking at the number of parties and colliders and the number of cores in your CPU, I'm sorry, but it's a simple performance limit.
    [Once] is calculated once per frame.
    In [Unscale], the calculation is performed every 1 / 90s regardless of the FPS, so the calculation may be performed multiple times in one frame.
    For this reason, Unscale is more expensive.
    Also, if you use a lot of MeshCloth, the process of skinning the Virtual Deformer and the process of writing the calculation result to the Renderer will occur.
    These two loads are quite heavy and consume about 1/3 of the total time.

    For now, the only way to avoid it is to turn off the components of characters that are far from the screen or the camera.
    In this case, the [Distance Disable] feature may be useful.
    https://magicasoft.jp/en/distance-disable-2/
    Also, if the FPS of the game is stable, Once is fine.
    In this case, the load is constant for 5ms.
     
  18. athert

    athert

    Joined:
    Dec 31, 2012
    Posts:
    24
    Hello.
    This is something i also already mentioned before.
    Distance disable is already set to 20m but there was almost no increase so i tried disable all components from script to see if i can realtime disable/enable magica but it seems that its not working (You can see i talked about components about it in my post #712). Can you please check that post and confirm or decline that issue i mentioned there? maybe there is just missing checks in Jobs. I will gladly disable all components if character will be far away but currently its not possible (it is but there is no difference in performance)
     
  19. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Hello.
    In response to your indication, we performed the performance test of [Distance Disable] and the enable switching of the component again.
    As a result, as you pointed out, it turned out that the calculation load does not decrease much even if the active components decrease.
    It is actually decreasing, but the rate seems to be low.
    This becomes more noticeable as the number of components increases.
    (If there are hundreds of components)

    I know the cause, but I can't do it right away because the improvement requires a major modification of the calculation process.
    However, I think this issue should be improved, so I would like to prioritize performance optimization and incorporate it into the roadmap.
    I'm sorry, but the improvement will probably take months.

    Thank you for your suggestions.
     
    athert likes this.
  20. WILEz1975

    WILEz1975

    Joined:
    Mar 23, 2013
    Posts:
    343
    It looks nice but there are a lot of parameters to set.
    I can not achieve good results until after many trials.
    It would be nice to have more types of presets.
     
  21. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Hello.
    Thank you for your feedback.
    Certainly there may be a few too many parameters.
    If we decide to make version 2.0, we would like to significantly reduce the parameters.
    Did you know that you can save the parameters as presets yourself?
    https://magicasoft.jp/en/magica-cloth-preset-2/
    Using this feature to save the parameters that worked will make it easier to reconfigure.
     
  22. regddfgdf

    regddfgdf

    Joined:
    Feb 25, 2020
    Posts:
    1
    Hello! I used Magica Cloth in my project but I had some problems with big model which I need to import in scene. Cloth works different way in this model if it is the same size as in example unitychan and if I scale my model (when I import it).
    Is there any restrictions for size of model what I can use?
     

    Attached Files:

  23. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Hello.
    First, Magica Cloth performs physical calculations with Unity's distance of 1.0 as 1m.
    If it is a normal human body, it is about 1.7m, so it is about 1.7 of Unity.
    So if you scale your character to a giant like 10m, the simulation will be very slow.
    This is the same as Unity's Physics system.
    Therefore, if it is a normal human body, it is necessary to set up the cloth after making it about 1.0 to 2.0 in Unity.
     
  24. littenli

    littenli

    Joined:
    Dec 18, 2019
    Posts:
    5
    My dress model is separated from the inside and outside. When the character is in motion, the inside clothes will penetrate to the outside.
    Can I set self-collision between the fabrics, please?
    How can I solve this problem?

    2.png
     
  25. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Hello.
    I'm sorry, it's difficult to prevent such outfits from penetrating because there is currently no self-collision feature.
    However, in order to solve such a problem, we are currently experimenting with self-collision.
    I would like to solve it in some way in the future.
     
  26. mchung123

    mchung123

    Joined:
    Jul 4, 2017
    Posts:
    21
    I have noticed there is a world influence, I was wondering how I would go about dragging a bone and then letting it go?, it seems when I use the transform for world influence it immediately springs back
     
  27. mchung123

    mchung123

    Joined:
    Jul 4, 2017
    Posts:
    21
    Actually let me rephrase that, if I want to drag on a bone, then have it morph then release it have it spring back how would I do that using magicka ? is that even possible?
     
  28. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Hello.
    Currently there is no function to grab and pull bones yet.
    "World Influence" is a parameter of how much the movement amount is applied to the simulation when the character moves.
    Therefore, it is different from the function of grabbing bones.
     
  29. zavidiy

    zavidiy

    Joined:
    Jun 5, 2017
    Posts:
    9
    Hello. Is it possible to use collider with MagicaBoneSpring?
     
  30. MasterStrategist

    MasterStrategist

    Joined:
    Dec 7, 2017
    Posts:
    2
    Hi, I've recently come back to intergrating Magica Cloth and things are looking fantastic!

    I'd like to ask if I can somehow prevent colliders from penetrating to the other side of some cloths.
    I'm trying to simulate skin so colliders should always push particles away from their mesh normals.

    I've tried modifying the collision code but seems beyond me, could you give me some advice?
     
  31. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Hello.
    Unfortunately, it is currently not possible to set colliders in BoneSpring / MeshSpring.
     
  32. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Hello.
    MagicaCloth has a "Preventing penetration" feature to prevent intrusion into colliders.
    Please set it up referring to here.
    https://magicasoft.jp/en/prevent-penetration-2/
     
  33. mchung123

    mchung123

    Joined:
    Jul 4, 2017
    Posts:
    21
    Will, you ever have or consider the bone pulling? or is that out of scope for you ?
     
  34. bthanse

    bthanse

    Joined:
    Jun 24, 2019
    Posts:
    64
    My first try. Any tips to make it more natural ? I wish there was a good video turtoal how tu use it.
     
  35. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Hello.
    The ability to grab and pull particles is included in the roadmap.
    However, we are currently working on performance optimization, so we have not yet put in that work.
    We plan to implement it in the future.
     
  36. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Hello.
    That's a wonderfully engaging video!
    Unfortunately, there is no video tutorial available.
    Hair behavior is difficult and requires a lot of trial and error.
    Since it varies depending on the length and shape of the hair, it is not possible to provide clear parameters.
    However, MagicaCloth has a variety of presets available.
    https://magicasoft.jp/en/magica-cloth-preset-2/
    Try applying them first.
    If the movement is close to what you expect, you may want to tweak the parameters.
     
  37. zavidiy

    zavidiy

    Joined:
    Jun 5, 2017
    Posts:
    9
    Is it possible or planned to clamp bone rotation by axis? Or how can this be done?
     
  38. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Hello.
    Currently, only the overall angle limit can be set regardless of the axis.
    https://magicasoft.jp/en/paramater-clamp-rotation-2/
    There are no plans yet to add this feature at this time.

    For your information, where do you expect to use the per-axis control?
     
  39. bthanse

    bthanse

    Joined:
    Jun 24, 2019
    Posts:
    64
    Mash / bone: I have trying some models, but I have not seen hair that I can use with bone.Is it something that I have to add to a model, or is it on some models ? upload_2021-4-20_19-55-37.png
     
  40. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    361
    Hello.
    I'm still not understanding your problem well.
    Is the problem in the MagicaCloth simulation?
    Or is MagicaCloth not working in the first place?
    A tutorial on basic setup can be found at the following link.
    It may be of help to you.
    https://magicasoft.jp/en/bonecloth-start-2/
    https://magicasoft.jp/en/magicaclothmeshclothstart-2/
     
unityunity