Optimizing 10,000 trees for mobile!
I'm trying to brainstorm ways to improve my framerate which is currently being dragged down by trees. Originally I used the unity terrain system with low billboard start settings, the terrain system can be problematic and isn't achieving the desired framerate.
These are the options that I'm currently pondering:
Keep using the unity terrain system, find some way to optimize it
Use some shader that billboards my trees outside the scope of Unity terrain
Create custom LoDs (Didn't respond well to initial stress test) or use this
Set up occlusion culling (So far the only thing it's done is reduce my framerate)
Some combination of the above
About the current trees:
• Each tree is only 500 polygons
• Each tree currently has two shaders: unlit-transparent for the leaves, and mobile-diffuse for the trunk
• Each tree consists of two submeshes: one for trunk and one for leaves
Answer by NorthStar79 · Jul 28, 2017 at 02:14 PM
first, combine your trees into 1 mesh and use only one material. second, mark them as static. (but not lightmap static this makes light baking impossible) third, you will probably won't need cast shadows for all of them, check half of thems cast shadow flag (trust me if they all close together players will not notice it) fourth, do not use colliders if you can, or use only sphere colliders (1 box collider costs as 5 much as 5 sphere collider)
Last but not least, don't even try to make 10.000 trees in one scene. maybe you should check world streaming solutions too.
So I ran a test and the following setup:
All one mesh
All one material
No collision geometry at all
Fully unlit
is actually less performant than Unity's basic terrain system with billboarding turned up.
Your answer
Follow this Question
Related Questions
Hotkeys system performance optimization 0 Answers
Using separate GameObjects for "generic" scripts (Performance) 1 Answer
High GPU Usage 500 FPS 1 Answer
Profiler knurl ... 0 Answers
Gfx.WaitForPresent rant, and editor fix 0 Answers