I am making a mobile 3d fps game and have lots of third-party assets on the scene. Usually, in play mode, I have around 600k tris shown on the ‘Stats’ window, but at some certain location and camera angle, it rises up to 2.5M tris. I’ve tried occlusion culling, but it does little in that particular situation. So I’ve decided to implement LOD for objects that are numerous and have high poly count. The question is, how to identify those objects?
I’ve tried frame debugger, but it only shows total polygon count in a certain SRP batch. What I need is total polygon count produced by a prefab in this frame, which is calculated by number of instances of this prefab times polygon count of this prefab. Also, I need to sort out from most influencing prefabs to least ones. I’ve tried RenderDoc as well, but could not figure out how to do this.
One more question, what is an acceptable upper limit for a triangle count in a mobile shooter game if I aim to run it at 60 fps?
Such a recommendation is not possible. Consider the question is similar to asking “what is the upper limit of components running Update() to run at 60 fps”? This depends on the hardware and what the Update() methods actually do. Although triangles in themselves do little, they are typically not the main issue on mobile devices - these are largely bound by bandwidth / overdraw (memory speed) and shader operations.
The Stats window is only a very, very rough ballpark indicator. You will want to profile the game on the device! You cannot (should not) optimize until you know exactly what the performance issue is. It might not be triangle count but (most likely) number of draw calls.
You don’t really identify particular objects, unless you meant that you don’t know what the most triangle-heavy meshes are in your game. In that sense you could inspect the MeshFilter/MeshRenderer sharedMesh and log or sort by vertexCount.
The LODs however take effect based on distance from the camera. If you intended to manually pick some objects to render in a lower LOD, you should instead change the original mesh and reduce it since that will provide better overall performance rather than a separate script that cherry-picks LODs.
couple of millions on mobile? what phone target demographic you want to release the game for?
Just look at the objects information in the Project window. Click on the imported object, fbx or whatever it is and it will tell you how many polygons it has
Also subpixel tris is really expensive to render,.more so on mobile. Though no good tool to detect those you can use the wireframeshader subpixel tris should be visible then.
You optimize this problem by using LODs with large enough tris so that at the distances they are used at they will not produce sub pixel tris.
couple of millions on mobile?
this was the question I asked at the last part. Is this ok or not ok for mobile in general? I know it depends on hardware, but lets assume that most percentage of the average wealth population have decent phones, capable of running COD mobile at minimal graphics at playable FPS. As for the demographic, I want it to cover as much as possible, but generally, since this is a zombie game with blood and gore, it will be 18+.
Thanks for your detailed reply. I know that it all depends on hardware, but lets assume average phone performance, exclude too cheap phones (below $100) from the equation. So, in order to maximize
phone coverage, assuming that they are capable of rendering COD mobile at lowest settings at 60 fps, what triangle count is too much for the game? I understand that there are many other factors contributing to overall performance, but since the game is at early stage of development, I want to keep polygon count as low as possible. Since LOD-ing every object comes at its own cost, I want to LOD only particular ones that contribute most to the polygon count. For example, lets assume there is one street_lamp_A prefab of 10k vertices mesh on a scene and 1000 instances of street_lamb_B prefab with 5k polygons each. In this case, I ignore street lamb A because there is only one instance (10k poly in total) and I would want to identify street_lamb_B as the most significant contributor and implement a LOD in it, in order to reduce overall polygon count. There are many prefabs in the projects and many objects in the scene, so it is very difficult and time consuming to identify it manually. So the original question was, is there any tool or technique to do this automatically? Or maybe there is easier approach?
for nice reference / ideas, check how they optimized this game:
(lots of custom tooling and its not mobile phone game, but can get ideas)
for your case,
you could make editor script to identify those heavy object in view.
there are overdraw tools also available.
Thanks, I’ll definitely check this out
for regular meshes,
this is what i use to get top20 vertex count list from selected gameobjects (and children) in scene:
Thanks for sharing this. This code looks like the solution, but I need to slightly modify it so that it shows top contributors, rather than just the most vertex heavy objects. By saying ‘top contributor’ I mean, number of prefab instances multiplied by prefab vertex count.
Still this is not helping, because this doesn’t show the result after LOD is applied. As written before, polygon count rises to 2.5M at certain location and certain camera angle in play mode. So, I think its better to use the results from Frame Debugger and not just Hierarchy window. Is it possible to export the result of frame debugger to parseable format so that I could write a code that analyzes it and identifies the top 20 polygon count contributors?