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. Dismiss Notice

Question why the same fps on different video cards?

Discussion in 'General Graphics' started by Zimaell, Feb 12, 2023.

  1. Zimaell

    Zimaell

    Joined:
    May 7, 2020
    Posts:
    341
    I created a simple scene (URP) with 1000 animated prefabs (walking people), then I ran it on two different video cards (Radeon R7 360 and GeForce GTX 1050 ti), they pretty much differ in performance, but the fps on them was the same.
    I suspect that the load goes to the processor and not to the video card, but why, how to make the application work normally, I mean that animated prefabs should be processed by the video card, I think so. Tell me what to watch, where to configure, where to look for a problem?
    (on material GPU instancing included)
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,397
    1. Make sure GPU skinning is enabled.
    2. Attatch the profiler in a build to see where performance goes
     
  3. Zimaell

    Zimaell

    Joined:
    May 7, 2020
    Posts:
    341
    GPU skinning ON.
    but I don’t really understand the profiler, here is a screenshot that shows me, but I don’t understand what to look at ...
     
  4. Zimaell

    Zimaell

    Joined:
    May 7, 2020
    Posts:
    341
  5. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,397
    You can see the animators take up 50ms. So you are CPU bottlenecked.
    For large crowds maybe bake the animations into vertex animations if possible. Otherwise use smart culling and LODing to render large crowds. Turning down the bone count in quality settings to 1 also might help
     
  6. Zimaell

    Zimaell

    Joined:
    May 7, 2020
    Posts:
    341
    yes, I tried all that, reducing the number of bones (from 4 to 1), reducing the polygons on the model (reducing the quality of the model in blender to 1%), it didn’t really affect performance, so I wondered why such obvious things don’t help performance. And then it turns out that there is no difference from the video card, so I'm looking for a solution to this problem, what can I do wrong, what am I missing ...
     
  7. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,397
    Use less characters or optimize. The animator is really heavy to run
     
  8. Zimaell

    Zimaell

    Joined:
    May 7, 2020
    Posts:
    341
    I thought the problem was somewhere in some settings, I thought the better the video card, the more FPS, and since the video card does not affect, it means that it is not configured correctly. well, as I understand it, the player must control a full-fledged model, and all NPC animations must be baked, probably this is how it should work. but all the models also have clothes, what do you think - they can be baked and dressed separately, or do you need to bake all the variations, how to do it right?
     
  9. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,397
    You can put in a massive GPU, but if the CPU is the issue it doesn't matter. Only if you are GPU bottlenecked.
    And yes, baking to vertex animation probably is most performant. It depends on the project which optimizations are most suitable
     
  10. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    For anything more than maybe a dozen characters the Animator component is far too heavy (depending on how complex your graph is, even less), and for more than. A hundred not even the legacy Animation component will cut it.
     
    DevDunk likes this.
  11. c0d3_m0nk3y

    c0d3_m0nk3y

    Joined:
    Oct 21, 2021
    Posts:
    551
    As others have mentioned already, even with 100 characters you are already running into performance issues on both the CPU and GPU.
    You can try this experimental Unity package for vertex animation textures (VAT). It's not very well written, but it should get you started. The downside of VATs is that you can't blend between animations.
    Here is a great article, if you want to learn more about VATs.
    You can also try Kinematica, which uses Motion Matching. AFAIK, it is more performant than Animators because it uses burst jobs. You usually need motion capture data, though. Also, it has been discontinued, unfortunately. There is also a plugin you can purchase called MxM.
    Unity is aware of this problem. That's why they are working on DOTs Animation. Unfortunately, it's not yet compatible with the current ECS version.
     
    joshuacwilde likes this.
  12. Zimaell

    Zimaell

    Joined:
    May 7, 2020
    Posts:
    341
    thanks for the tips, very helpful.
    someday, probably in unity, everything will be ready, just arrange the objects where necessary, only then it will only be paid, probably:D
     
  13. Zimaell

    Zimaell

    Joined:
    May 7, 2020
    Posts:
    341
  14. VictorKs

    VictorKs

    Joined:
    Jun 2, 2013
    Posts:
    242
    You are most likely CPU bound the animator Component uses a lot of resources. I had the same problem some years ago the solution is handling the animations directly inside the GPU through shaders. Depending on your needs and experience there are several solutions.

    Vertex animations is the easy method where you practically bake the vertex positions of each frame to a texture or buffer. And cycle through the frames inside GPU when you reach the last frame loop from the start. You bake positions to texture by assigning the X/Y/Z position of each vertex in the R/G/B chanel of each texture (btw the texture must be uncompressed 16-32 bits per channel)

    GPU skinning is the preferable way here you need to store bone transform data in texture/buffer for each animation and bake blend weights and bone ids to mesh UV3/Color channels and inside vertex shaders transform each vertex by the corresponding bone matrices.

    If you have no experience with shaders you can bake the animation to static meshes for each frame and change MeshFilter.Mesh cycling through the baked meshes.

    Here is a Unity implementation of Skinning in the shaders, also there are many assets in the asset store.
    https://github.com/Unity-Technologies/Animation-Instancing

    Edit: Btw I haven't read the replies in case someone has already answered.