Hi, I am trying to find the bottleneck in a game prototype I am doing right now. It is a racing game, and we are using quite complex vehicle models at the moment (we need to reduce complexity at one point, but that is still in the future).
I am trying to find out what exactly is the reason why performance drops so much when I go from 2 vehicles in the scene to 4. While Tris count and Drawcalls do explain part of it, the interesting thing is:
Renderer Thread time stays the same (roughly)
Main Thread goes up by 50%
Now, I am not literate enough about what runs in the main thread, and what is running in the renderer (thread?). It could be very well that my Graphics card has no problem handling the 400k more tris and 600 Additional Draw calls caused by all the shaders and shadows, and our not-so-efficient model at work, but the additional code attached to the two additional vehicle gameobjects eat up most of the performance lost (I make heavy use of the Physics system).
Could someone tell me what is running exactly in the main thread? Does it also include graphics stuff (the part running on the CPU)? Is the renderer Time the time needed by the GPU?
Is it safe to assume the performance is lost because of the added tris and drawcalls, but in the CPU (thus the drawcalls are the main problem)? How can I profile if its graphics or gamelogic / physics code that contribute to the 50% increased time of the main thread?
I did now finally went into unity and found the profiler… why didn’t I think of that before?
But I am not sure I am reading the results correctly:
More than half the CPU time is spent on Rendering. I assume this should be significantly lower? Most probably too much draw calls?
Most GPU Time in the chart is deferred lighting, postprocess effects and opaque, in this order. But in the Hierarchy view I see most percentage used in Drawing Render.OpaqueGeometry and Culling…
The fact that 12% of the CPU is taken by Unity when running the game on a 6 core I7 seems to point into the direction that the main thread on the CPU is completly overloaded, while the GPU does not seem to really run hot (GPU Fans inaudible, so they’re running at low speeds still). I might need to look into GPU profiling to really find out if the GPU is not maxed out…
But this to me sounds like a clear case of too many draw calls for a game with complex scripts and a lot of Physics…
Btw, Drawcalls are at 2.8k, Tris at 1.6M, verts at 1.2M
Hm, I thought so… well, I will check out all the atlasing and mesh combine tools in the asset store and what they can do. MeshCombine alone does not seem to do the trick.
And of course this is all before using occlusion culling, that might help too.
I assume having a nightime scene with lots of lights, some of which uses shadows (2 directional, 1 with shadows, 34 spotlights (most under 20 meter range, 4 with 75 meter range), 4 with shadows, hundreds of small point lights with 5 meter range, no shadows) won’t help, not even with deferred lighting?