Search Unity

(Case 977420)The performance of cloth physics drop dramatically since Unity 5.6

Discussion in 'Physics' started by nirvanajie, Dec 11, 2017.

  1. nirvanajie

    nirvanajie

    Joined:
    Jan 7, 2016
    Posts:
    42
    Hi, everyone.

    Recently I found the performance of cloth physics drop dramatically since Unity 5.6 so I thought I'd share some info in case anyone else is affected.

    At first, I saw Alejandro0190's post which mentions his hair assets remove all the cloth physics because of the bad performance since Unity 5.6. I was very surprised and I did a quick test.The result is the same as Alejandro0190's.

    In my test scene, the performance in Unity 5.5 is about 3.6ms.The performance in Unity 5.6 and Unity 2017 is about 12ms. The CPU usage of Physics.UpdateCloth increase from 2.5ms to 11ms.Here are the screenshots.

    Unity 5.5.1f1



    Unity 5.6.4p4


    Unity 2017.2.0f3



    I just put two skin mesh object into the scene(dress mesh is 9226 verts,hair mesh is 13906 verts), then add cloth component to the skin mesh object. Finally I paint the verts on the top of mesh to fix these meshes. Very simple.

    Tested with Unity 5.3.8f1, 5.5.1f1, 5.6.3f1, 5.6.4p4, 2017.1.1f1,2017.2.0f3.
    Tested with DX11 and V-Sync off.
     
    Last edited: Dec 13, 2017
  2. nirvanajie

    nirvanajie

    Joined:
    Jan 7, 2016
    Posts:
    42
    I did a further test.I just put one dress(40020 verts) in the scene and add cloth component to this object.

    The performance in Unity 5.5 is about 8.0ms. The performance in Unity 5.6 and 2017 is about 680ms! The cloth physics is definitely broken.

    I also notice the verts count is 161k which should be 45k in Unity 5.5



     
    Last edited: Dec 15, 2017
  3. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,478
    I am very interested with response from Unity about this.
     
  4. DrInternet

    DrInternet

    Joined:
    Apr 6, 2014
    Posts:
    94
    Actually I was wondering the same after seeing this hair pack. Today I decided to google this up, and the only thing that popped out was your thread. What's funny I tested it in Unity 2017.3 with "number of improvements to Cloth physics" and it worked as bad as in 5.6 and 2017.2.
     
  5. nirvanajie

    nirvanajie

    Joined:
    Jan 7, 2016
    Posts:
    42
    Yes, I also hoped thing is getting better in Unity 2017.3 but I was wrong. We are discussing this issue in this thread(https://forum.unity.com/threads/case-978199-the-cloth-physics-is-broken-in-unity-2017-3-0f2.508696/). You can find more info there.
     
  6. DrInternet

    DrInternet

    Joined:
    Apr 6, 2014
    Posts:
    94
    So today I decided to redo the test with unity 2018, 4 months after last 5.6 patch. Looks like cloth was fixed but, not in a version I would like, which is 5.6.

    Test was done on 9.5k verts skinneg mesh. Big numbers are fps in stats window. Small numbers are cloth execution time. "Nothing" means no "maximize on play" checked, so both scene and game window were render at the same time. "Profiler" is test with profiler running.

    5.5
    nothing 700-750
    profiler ~750
    nothing+max window 750-800
    profiler+max window ~750 (.8-.9(1.0))

    5.6
    nothing ~480
    profiler ~500
    nothing+max window ~500
    profiler+max window ~485 (1.5-1.6(1.7))

    2017.4.0
    nothing ~480
    profiler 330-340
    nothing+max window ~500
    profiler+max window 330-350 (1.5-1.6)

    2018.2b
    nothing 800- >800
    profiler 680-700
    nothing+max window 800- >800
    profiler+max window <700 (.6-.7)


    Conclusion:
    5.6 and 2017.4 works the worst with 5.6 slightly better prolly because of worse Unity gui rendering since 2017; script execution time is about the same.
    Then 5.5 which works about twice as fast as 5.6.
    Then 2018.2 which runs even better than 5.5.

    Let's not delude ourself, it's either upgrade to 2018 or some custom cloth system, a chance than 5 cycle will be fixed is rather slim; very slim.
     
    nirvanajie likes this.
  7. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,478
    Dark times for 2017.4 developers.. :(
     
  8. GloriaVictis

    GloriaVictis

    Joined:
    Sep 1, 2016
    Posts:
    99
    Bump - any chance you were doing tests on LTS 2017.4 versions?