Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question How to Profile individual model's effect on performance?

Discussion in 'Editor & General Support' started by h1ggs, Nov 29, 2023.

  1. h1ggs

    h1ggs

    Joined:
    Dec 21, 2017
    Posts:
    14
    I have a decent number of heavy models in my scene - I'd like to be able to see which of the models are hitting the GPU the hardest.

    I've tried turning them off one by one and watching the profiler, but it hasn't been useful.

    Like in the build report from builds, I'd like to see a list of the highest impacting models like the report does for textures, sounds and such.
     
  2. CodeRonnie

    CodeRonnie

    Joined:
    Oct 2, 2015
    Posts:
    531
    Since isolating models one by one in the profiler didn't yield helpful results, you could try using the frame debugger to step through rendering a typical frame step by step. It's a fascinating tool that I don't see mentioned very often. I always find it interesting to step through the rendering process step by step and see how many draw calls you're dealing with and how much overdraw there is and things like that. You might get some kind of clues about performance just by watching what the GPU is actually doing one step at a time.
     
  3. h1ggs

    h1ggs

    Joined:
    Dec 21, 2017
    Posts:
    14
    Frame debugger is helpful although I'm using URP and many models get SRP batched together. It is a great tool though I love using it.

    I've resorted to opening every model in Maya, checking the Game Vertex count and cleaning up unneeded secondary UV channels that were doubling and tripling overall vertex count. I've also turned off exporting Tangents and Binormals for the FBXs to save on memory since all of my materials have tiled normal maps.
     
    CodeRonnie likes this.
  4. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    6,486
    The problem with the single-model-measurement approach is that it's an artificial test. The hardware can 100% focus on rendering that one mesh and this is unlikely to put any pressure on any subsystem, so they just rock through it.

    I would recommend to write a script that puts 10, 100, 1000 instances of the mesh in the scene and measure that. Just so many that the fastest mesh barely scratches the 60 fps mark. Then you have a baseline that you can immediately grasp from a single number.

    Something like this:
    100 Meshes "A" => 55 fps
    100 Meshes "B" => 49 fps
    100 Meshes "C" => 23 fps
    100 Meshes "D" => 12 fps

    You'll quickly see which ones are worth optimizing and which aren't.

    But note that even this test may be off because, let's say Mesh "D" would extremely benefit from instanced rendering but it's not enabled, so enabling instancing could make it a couple factors faster without having to change the mesh. Or Mesh "D" is only ever used as a single mesh in a small isolated area, so it wouldn't hurt performance as much as Mesh "C" that's used dozens of times everywhere.
     
    MartinTilo and CodeRonnie like this.