Search Unity

Question First MeshSkinning.Render drawcall is extremely slow

Discussion in 'General Graphics' started by Andr9651, Mar 1, 2023.

  1. Andr9651

    Andr9651

    Joined:
    Oct 3, 2018
    Posts:
    3
    I'm using unity 2020.3.36f

    I'm trying to optimize a game to perform well on mobile and have noticed a bottleneck with the SkinnedMeshRenderer specifically the first drawcall of a skinned mesh.
    7% might not seem like alot but it becomes around 25% GPU time on mobile.

    I've searched around and have only been able to find this: first-skinnedmeshrenderer-is-extremely-slow, which isn't relevant for me since i only have 1 camera in my scene.

    The meshes consist of, at most, 900 verticies and 1350 triangles, and the animation is a simple idle sway.

    It seems to only be the first MeshSkinning.Render call (always first in Raw Hierarchy) since disabling only moves the problem to the next one.
    It also doesn't happen in all scenes, so i suspected that the player prefab might have been modified, But replacing the player gameobject with one from a scene without the problem still didn't fix the issue. upload_2023-3-1_13-29-13.png

    I previously had a similar issue with SkinOnGPU, where it once again only was the first one. I just decided to disable GPU skinning to "fix" it since I'm heavily GPU bottlenecked. (Ignore the high amount of drawcalls, they have since been optimized away)
    upload_2023-3-1_13-53-11.png

    Edit:
    I've done some more debugging and it seems to be related to where in the level the player is. Some places on mobile result in almost 7 ms while other places gets as low as 0.03 ms. Though I have yet to figure out the connection. At first it seemed like it was dependent on how long the rest of the frame took to render but that didn't seem to be the case as i found places with significantly lower overall frametime but still high MeshSkinning.Render.
    The searching continues...

    Edit 2:
    I forgot to mention that I've tried reducing the skin weights to 1 with no change.
    I've also found out that the performance issue seems to disappear if I disable Unity's terrain, which isn't an option for obvious reasons.
     
    Last edited: Mar 2, 2023
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,060
    Maybe reduce the skin weight in quality settings?

    Skinning is pretty expensive on CPU, so I would recommend putting it on GPU (even if it's bottlenecked, but it can be multiple magnitudes faster)
     
  3. Andr9651

    Andr9651

    Joined:
    Oct 3, 2018
    Posts:
    3
    Thanks for your reply :D
    It doesn't matter that its generally faster on the GPU, when im heavily GPU limited, especially when its performing so badly. Its impact on CPU time is basically insignificant in my situation.

    I have already tried reducing the skin weight to 1 bone with no impact at all, I should have mentioned that in the post.