Search Unity

[RELEASED] Magica Cloth

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

  1. themightyx

    themightyx

    Joined:
    Nov 25, 2014
    Posts:
    3
    Update on issue:
    Problem is not the VirtualRenderer component as originally suspected.
    Proxy mesh is created without any deformities when applied to bindPose.
    After animator is enabled the mesh deforms, even when no animation is applied to the joints affecting that area.
    Before Animator:
    BeforeAnimator.JPG

    After Animator:
    AfterAnimator.JPG

    I will investigate further.
     
  2. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    922
    Hello.
    This issue seems to be caused by the removal of the MagicaCloth bones that are prefabricated.
    I'm not familiar with Q-costume, but I think it's probably a dress-up system.
    Basically, the following steps are performed to change clothes.

    (1) Attach the dress-up parts to the main body
    (2) Replace the bones of the dress-up parts with the bones of the main body

    Therefore, when changing clothes manually (Q-costume), the bones in (2) are replaced, and it is probable that Q-costume is deleting unnecessary bones.
    In this case, you need to replace the MagicaCloth bones with the body bones before Q-costume removes the bones.
    The function that replaces this bone is ReplaceComponentBone ().
    See the documentation for how to use it.

    https://magicasoft.jp/en/corecomponent-2/

    Consider whether this function is available.
     
  3. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    874
    I think i understand what you mean, i will try it.
     
  4. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    922
    Hello.
    It may be using the old [Jobs] package.
    From one version Unity renamed the Length property of NativeMultiHashMap to Count.
    In the latest Magica Cloth, the code has been modified to match the Count.
    Therefore, try updating the [Jobs] package to the current latest version.
     
    ARon_w likes this.
  5. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    874
    Wait, but what about when using mesh cloth, is it the same issue?

    Is this something i would need to use with the MagicaAvatar component?

    Could i send you a project to take a closer look? I don't think q-costume deletes bones only adds them if they're missing.
     
  6. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    922
    Hello.
    I replied by e-mail, but I will write it here as well.
    First of all, it seems that we need an option to use the original mesh as it is, so let's consider this implementation.
    However, basically, I did not expect the mesh to be irregular so far as shown in the image.
    This may be a bug.
    Also, although it is a setting, basically it is not recommended to turn off the [Use Skinning] check in the case of skinning mesh.
    If this is turned off, the vertices in the virtual mesh will not be skinned.
    First of all, could you please set the reduction settings back to the image and test again? reduction-1.jpg
     
  7. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    922
    Bone replacement is possible even with MeshCloth.
    Basically, if you want to replace bones manually, you need to execute ReplaceComponentBone () for all components (RenderDeformer / VirtualDeforemr / BoneCloth / BoneSpring / MeshCloth / MeshSpring).
    The Avatar / AvatarParts system performs all of this series of operations automatically.

    I don't know the inside of Q-costume, but at least MagicaCloth doesn't delete bones (Transform) without permission.
    If you send us your project, we can verify it here.
    However, it will take some time because we are doing other work.
     
  8. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    922
    Update: 1.8.2

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

    This time it's almost a bug fix.

    Release Note:
    Added: Added API for Penetration's [MovingRadius] parameter.
    Fix: Fixed an issue that could cause an error when adding a collider with AddCollider() during execution.
    Fix: Fixed an issue where colliders added during the run were not removed correctly.
    Fix: Fixed an issue that caused code warnings in Unity 2020.
    Fix: Fixed an issue that caused an error when using MAGICACLOTH_ECS Define in Unity 2018.

    https://magicasoft.jp/en/release-note-2/
     
  9. VanDraven

    VanDraven

    Joined:
    Oct 31, 2012
    Posts:
    6
    Hi, I love MagicaCloth and I wonder if it is possible to modify the teleport detection system in a way that when triggered, the world influence is null (but gravity, colliders, ... stays). And I would love a way to trigger / untrigger by script this teleport feature.

    Thanks a lot for the hard work!
     
  10. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    922
    Hello.
    Teleport can be manipulated with scripts.
    Please refer to the following API documentation.
    https://magicasoft.jp/en/basecloth-2/

    You can reset the simulation with ResetCloth ().
    This is the same as teleporting.

    You can turn the teleport feature on and off with the WorldInfluence_ResetAfterTeleport property.
    WorldInfluence_SetMovementInfluence / WorldInfluence_SetRotationInfluence / WorldInfluence_TeleportDistance /
    WorldInfluence_TeleportRotation
    It is possible to adjust the parameters by using.

    I hope this helps.
     
  11. VanDraven

    VanDraven

    Joined:
    Oct 31, 2012
    Posts:
    6
    Thanks for the answer. The issue is that ResetCloth() results in an "exploding cloth" so I assume it resets cloth data.
    Is it possible to have another function triggered by the teleport detector that "freezes" the world influence?
     
  12. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    922
    I'm sorry, I still don't understand well, probably because of the translation.
    Does this mean that you want to register a callback function for teleporting?
     
  13. VanDraven

    VanDraven

    Joined:
    Oct 31, 2012
    Posts:
    6
    I'm french so I might have some trouble explaining myself in english ;-)
    A callback would be great! Or you could add a choice between the current ResetCloth or a "ignore world influence" function that would be triggered by the teleport detector.
     
  14. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    922
    Could it be that you want the simulation to carry on as it was before teleportation without resetting the simulation after teleportation?
     
  15. VanDraven

    VanDraven

    Joined:
    Oct 31, 2012
    Posts:
    6
    That's exactly that!
     
  16. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    922
    I see, I understand!
    Certainly it may be useful to have this feature.
    I would like to test if this option can be implemented.
    However, since we are currently implementing a function to grab the cloth, it will be the next task.
     
  17. Acissathar

    Acissathar

    Joined:
    Jun 24, 2011
    Posts:
    677
    Hi @hoshos, another small best practice question.

    I have a new character with long hair and braids in the front. I have a collider set up on her chest to prevent the braids from clipping through, and to give the appearance of "resting" on the armor when not in motion:

    upload_2020-10-25_15-10-49.png

    and this works great when she's idle:

    However, as soon as she is in motion, the braids clip through the capsule and stick behind it until at rest again. What would be the best settings to prevent this clipping? I thought that having the collider thick enough would prevent them from even moving back there in the first place, but I seem to be wrong.


    Also incase it matters, the movement is all in Update. I have rewritten to no longer be using FixedUpdate :)
     
  18. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    922
    Hello.
    This problem is difficult because it depends on the shape of the hair, but the following ideas may be useful.

    (1) Place a large collider
    If you don't want your hair to dig into your body, you may want to put a slightly larger collider.
    The following image shows a large capsule collider for the body behind two ball colliders.
    hair1.png
    You may also set Collider Penetration in this state.
    Collider Penetration prevents hair from moving behind the collider.

    (2) Reduce the influence of movement
    You can reduce the influence of movement by lowering the [Movement Influence] of World Influence.
    You can also lower the maximum speed that your hair receives by lowering the Max Move Speed.

    (3) Clamp Rotation
    By setting Clamp Rotation, you can limit the angle at which the hair can be bent to the maximum from the initial position.
    However, be aware that if you limit it too much, dynamic movement will be lost.
     
    Acissathar likes this.
  19. Acissathar

    Acissathar

    Joined:
    Jun 24, 2011
    Posts:
    677
    Thank you! I think I've got it how I want it, or close enough at least. I appreciate the quick response!
     
    hoshos likes this.
  20. DigitalAdam

    DigitalAdam

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

    Hi, just checking to see how the cloth grab is coming along. Thanks.
     
  21. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    922
    Hello.
    I'm sorry to have kept you waiting.
    The grab function is currently under development.
    However, my main business has become a little busy, and I haven't had much time for development.
    (I work as a game programmer)
    However, we will definitely implement it, so please wait a little longer.
     
    ObiOneStenobi and NSokolovskyi like this.
  22. Acissathar

    Acissathar

    Joined:
    Jun 24, 2011
    Posts:
    677
    Hi @hoshos, one more question then I think I'm good for a bit.

    When running without vsync, and greater than 60fps, everything seems good:


    However, if I run with vsync and/or get around 60fps, then the hair starts working wrong:


    A few things I've tried:

    1. Adding a collider on the body to prevent the clipping
    2. Changing the Physics Manager to 60 Update Per Second + Once Per Frame / Unscaled Time
    3. Turning on/off penetration.

    The character is moving through update, and it is not root motion for the animations, everything is by script. Am I looking in the wrong spot, or is there something about higher FPS (in this example, around 2-300) that allows for the much smoother calculation?
     
  23. akihabarai965

    akihabarai965

    Joined:
    Oct 27, 2020
    Posts:
    6
    Hello hoshos,

    I'm very interested in this asset.
    This asset has a mesh cloth, but can it be used for complex meshes like pleated skirts?
    Adding the cloth component of unity to the pleated skirt will make the pleats crumple. It's very bad...
    If you'd like, I'd like to try this asset. Is there a demo version available?

    Best regards,
     
  24. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    922
    Hello.
    I still don't understand why it works like this.
    Can you tell me the update settings when Vsync is turned on?
    Is it [90_Default] in [Unscaled Time]?
     
  25. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    922
    Hello.
    Skirts are difficult and vary depending on the shape, but basically pleated skirts also work.
    This is because there is a function to perform cross simulation by converting a complicated mesh into a simple mesh while maintaining its shape by Virtual Deformer.
    Specifically, see the following document.

    https://magicasoft.jp/en/meshclothskirtguide-2/

    Send an evaluation version of Magica Cloth to your [InBox].
    Feel free to test it before you buy.
     
    Last edited: Oct 29, 2020
  26. Acissathar

    Acissathar

    Joined:
    Jun 24, 2011
    Posts:
    677
    I have tried a few different combos:
    1. 90_Default + Unscaled Time
    2. 90_Default + Once Per Frame
    3. 90_Default + Delayed Unscaled Time
    (to match the vsync frame count)
    4. 60 + Unscaled Time
    5. 60 + Once Per Frame
    6. 60 + Delayed Unscaled Time
     
  27. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    922
    Thank you very much.
    I'd like to check again just in case, but is it correct that the problem occurred in the following combination?
    [Vsync On (60fps) + 90_Default + Unscaled Time]
     
  28. Acissathar

    Acissathar

    Joined:
    Jun 24, 2011
    Posts:
    677
    Correct.
     
  29. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    922
    Thank you very much.
    I don't know the reason, but I'll try to find out the cause here as well.
     
  30. Acissathar

    Acissathar

    Joined:
    Jun 24, 2011
    Posts:
    677
    If it would help I can send you a stripped down project, maybe there's some setting I have that you'd notice right away?
     
  31. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    922
    really?
    It would be very helpful to have a reproduction project.
    I want it if possible.
     
    Acissathar likes this.
  32. Acissathar

    Acissathar

    Joined:
    Jun 24, 2011
    Posts:
    677
    Message sent with a package :)
     
  33. akihabarai965

    akihabarai965

    Joined:
    Oct 27, 2020
    Posts:
    6
    Thank you for sending me the download link for the evaluation version!
    I tried it out right away and I was able to get it set up in no time!
    Magica Cloth is very good. :D
     
    hoshos likes this.
  34. xDavidLeon

    xDavidLeon

    Joined:
    Jun 9, 2014
    Posts:
    123
    Hi there!

    I just bought Magica Cloth, but it crashes when making builds with il2cpp on windows. Builds work fine if you use Mono.

    I created an empty project that crashes and uploaded it here:

    https://drive.google.com/file/d/1ceVDrytyTVaamlkndldx1tFd7dzVFn_s/view?usp=sharing

    Just press build with Windows x64 as target and run it. It should open the UnityChan sample scene, but it crashes instead.

    Unity bug report: http://fogbugz.unity3d.com/default.asp?1288997_10lrjd8tjtldb9np

    Let me know if you need more info.

    - David L
     
    Last edited: Oct 30, 2020
  35. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    922
    Hello.
    Thank you for the project.
    I was able to reproduce the crash here as well.
    I would like to find out if this crash is a MagicaCloth issue or a Unity issue.
    This task may take some time.
    I don't know if it helps, but here's a workaround I've investigated.

    (1) Release build will work.
    Apparently the cause is the optimization of the Master build.
    It seems to work by switching to the Release build in a hurry.

    (2) Works for x86 builds.
    The cause seems to be x86_64 + Master + IL2CPP build.
    It seems to work when I switch the target to x86.

    If we find out the cause, we will report it on the forum.
     
  36. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    922
    Announcement

    Hello.
    After careful examination of this issue, I came to the conclusion that it was a bug in Microsfot's Linker.
    For more information, see Issue Tracker at:
    The problem is the [C ++ Compiler Configuration] option.

    https://issuetracker.unity3d.com/is...ws-standalone-build-with-master-configuration

    I figured out where it actually crashed, but the code didn't have any issues causing the crash.
    And when I commented out that code, the next crash happened in a completely different location.
    Therefore, we conclude that this is a complex optimization problem with [Burst] + [IL2CPP] + [Master] builds.

    To work around this issue as in the tracker, use [Release] instead of [Master] for [C ++ Compiler Configuration] when building IL2CPP on Windows.
    Unfortunately, there seems to be no other workaround at the moment.

    release-build-1.jpg

    This issue will be addressed in the documentation at a later date.
     
    Last edited: Oct 31, 2020
  37. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    922
    Hello.
    I analyzed your project.
    There are two reports.

    (1) Position of hair collider
    The vertical colliders placed on the hair are a little too far behind.
    Look at the image.

    before1.jpg

    In this way, the collider is absorbed in the hair particles from the beginning.
    The collider pushes the particles to the closest surface, so in this situation a small movement of the particles will push them towards the front of the collider.
    As a result, the hair penetrates the body and comes forward.
    Therefore, place the collider a little larger and a little in front as follows.
    This can greatly improve particle penetration.
    Here are the parameters of the collider I adjusted.

    after1.jpg

    collider-1.jpg
     
  38. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    922
    (2) There is a problem with collision detection
    The other is that I found a bug in the collision detection program.
    The problem is that the wrong position is calculated when the collision is judged with movement, and the result is slightly different.
    As a result, the particles that collide with the collider will vibrate when moving.
    Once the bug is fixed, the particle vibration problem will be significantly improved.
    I have already fixed this bug and am currently testing it.
    If there are no problems, I will update immediately.

    I will send this modified version to your [InBox].
    Please wait a little longer.
     
    Acissathar likes this.
  39. Acissathar

    Acissathar

    Joined:
    Jun 24, 2011
    Posts:
    677
    I really do appreciate you taking the time to look into it, thank you again! I'm in no rush so no worries there, I will adjust my colliders in the mean time and keep that in mind for future ones :)
     
  40. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    922
    Hello.
    I have sent a modified version of collision detection to your [InBox].
    Probably the collision detection should be much more stable than last time.
    We would appreciate it if you could test if this version solves this problem.
    Thank you.
     
  41. KenjiJU

    KenjiJU

    Joined:
    Dec 31, 2012
    Posts:
    23
    Hi.

    First I'd just like to say that this is a great tool and probably the best physics tool I've used in Unity so far, so thank you.

    I'm trying to use two bone springs for one bone--having one enabled and one disabled to achieve different settings and toggle back and forth. I am using gameObject.SetActive(true/false) in script. This works for one time and then I get an error.
    "ArgumentException: An item with the same key has already been added."

    Is this possible to do and what method should I be using? Thank you.
     
  42. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    922
    Hello.
    Thank you for your rating!
    First of all, unfortunately it is currently not possible to enable multiple BoneSprings for a bone.
    If you really need to switch, the following ideas may help.

    (1) Do not activate two Bone Spring
    If you activate two BoneSprings at the same time, an error will occur.
    However, if there is only one active, no error will occur.
    So if you want to switch between BoneSprings, try deactivating the currently running BoneSpring first and then activating the new BoneSpring.
    This way you won't get an error.
    However, switching is not very smooth.

    (2) Change the parameters
    Each parameter of BoneSpring can be changed by API.
    See the following documents for these.

    https://magicasoft.jp/en/basecloth-2/

    It requires a bit of programming, but it allows you to change the behavior of BoneSpring while it's running.
    This method is recommended.
     
  43. KenjiJU

    KenjiJU

    Joined:
    Dec 31, 2012
    Posts:
    23
    That solution worked for me, thanks! :D
     
    hoshos likes this.
  44. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    922
    Update: 1.8.3

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

    This time, the collision detection of moving characters has been greatly improved (some calculation errors occurred ...).
    The left side of the video is the operation so far.
    The right side is the latest version.
    The vibration that was generated when moving is almost eliminated with this correction.

    move_jitter3.gif

    Release Note:
    Improvement: Fixed several issues caused by collision detection. This has greatly improved collision detection accuracy, especially for moving characters.
    Fix: Fixed an issue that caused a data access error at the end of execution.
    Fix: Fixed an issue that caused vibrations in the collision detection of moving colliders due to a miscalculation.
    Fix: Fixed an issue where collision detection was not accurate when the drawing frame rate was higher than in physics simulation.
    Fix: Fixed an issue that caused a malfunction due to a calculation error in collision detection during delayed execution.

    https://magicasoft.jp/en/release-note-2/
     
    NSokolovskyi and bamncan like this.
  45. bamncan

    bamncan

    Joined:
    Dec 15, 2013
    Posts:
    47
    Hello,

    Thank you for very complex add-on.

    I have small problem. I think this is easy fix but I am blind.

    I cannot see Collider Gizmo in Unity 2020.1.12f1 of Magica Cloth 1.8.3. Is this bug, or am I forgetting to enable option?





    Thank you!
     
    Last edited: Nov 6, 2020
  46. weto4ka

    weto4ka

    Joined:
    Feb 8, 2019
    Posts:
    48
    Hello! I am using Unity 2020.1.9f and Magica Cloth.
    I have a character and clothes with BlendShapes. If I make any changes to the BlendShape, sometimes it breaks. I found that if I set up the Merge Triangle Distance and Merge Vertex Distance, if the character is standing and not moving, the vertices are in place and everything is fine. But if I turn on character animation, the fixed cloth vertices break the BlendShape of cloth. So it has strange move at fixed points, and cloth looks like some point are moved from their places (like stretching between fixed and moved point of cloth that looks unreal).
     
  47. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    922
    Hello.
    The Gizmo button in Unity 2020 is toggled.
    Click it like the image to make it gray.

    gizmo_toggle.png
     
  48. hoshos

    hoshos

    Joined:
    Mar 7, 2015
    Posts:
    922
    Hello.
    First, the vertices controlled by MagicaCloth are not available for BlendShape.
    We apologize for not clearly documenting this.
    However, BlendShape is possible for vertices that are not related to cloth simulation.
    This is the vertex that is set to gray (Invalid Point) when painting the Mesh Cloth, as shown in the image below.
    Therefore, try setting InvalidPoint for vertices that require BlendShape control.

    blendshape-1.jpg
     
    weto4ka likes this.
  49. weto4ka

    weto4ka

    Joined:
    Feb 8, 2019
    Posts:
    48
    Thanks a lot)
    Also I want to ask if there is a way to generate a Point Selection (Move Point, Fixed Point, Invalid Point) by script while the app is running?
     
  50. imariagano

    imariagano

    Joined:
    Dec 20, 2012
    Posts:
    25

    Attached Files:

    • eror.jpg
      eror.jpg
      File size:
      339.8 KB
      Views:
      347