Search Unity

Having issues with batching. SRP, Dynamic, Static and GPU Instancing.

Discussion in 'Editor & General Support' started by tomtefar, Nov 21, 2021.

  1. tomtefar

    tomtefar

    Joined:
    Mar 19, 2015
    Posts:
    6
    Hi,

    I've recently started to look deeper into optimizing my game to get it to a stable 60 fps on my machine. The game is a 3D 8-player top down arcade racer.

    So far I've used the Profiler to get rid of garbage generating code and cpu-hogging code, modified overly complex models and animations, etc.

    I'm now working on reducing draw calls and setpass calls. I've kept this in mind since the earlier stages of the project so I'm using as few materials and textures as possible, to the point of almost everything in the game (except the 8 player/cpu characters) shares the same material, shader and texture. The graphics style is cartoony and instead relies heavily on geometric features in the meshes and a post processing outlines shader in the render pipeline.

    My problem is that whatever I do and whatever batching settings I use I still get basically the same framerate and the same end user result. However, the amount of setpass calls, drawcalls, batches, CPU time, verts/tris drawn, etc varies wildly depending on the settings. The profiling is done on debug builds and not running in the editor. Please see attached images for details.

    What am I doing wrong or what have I missed? Or is this fine and there something else entirely I need to look into for further optimization? I would be eternally grateful if someone could set this straight for me.

    I'm using Unity 2019.4.25f1 with the Universal Rendering Pipeline and I'm running on an Intel Core i7-3610QM and a GeForce GT650M (yes my laptop is old).
     

    Attached Files:

  2. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    Did you consider your game might be GPU bound, since your GPU is fairly old? Does performance change significantly if you make the game window very small?
     
  3. tomtefar

    tomtefar

    Joined:
    Mar 19, 2015
    Posts:
    6
    Thank's for your answer! Having looked it up that does seem likely. I just figured that was a given for all games that they ran better at smaller resolutions but never considered the different parts played by the CPU/GPU in that.

    So what would be the best next step to increase performance without reducing resolution? I've ruled out occlusion culling since it's a top down perspective and everything is in view all the time anyway. There's also only one light in the scene (directional light) so baking makes negligible difference when I tried it. Reduce poly count and shader complexity?

    Either way I'm still confused by the batching results when all methods are in use (https://forum.unity.com/attachments/2021-11-21_srp-batch-on_dyn-batch-on-png.959122/). Am I reading it right that the GPU instancing batches nothing in that scenario? (Batched Draw Calls: 0, Batches 2401, i.e. one batch=one draw call). Most of the objects in my scene are marked static and share the same mesh/material (trees, rocks, track doodads, etc)

    And why does it report only 6k tris drawn when SRP batching is on and 700k+ when it's off? What is it reporting really?

    The reason I'm trying to push 60 fps on such old hardware is that I wish to target the Switch for a future release.
     
    Last edited: Nov 22, 2021