Search code examples
unity-game-enginerenderingtexturesspritemipmaps

Why are mipmaps not boosting sprite performance in this 2.5D scenario?


I have a situation where I have loads of high-resolution bushes.

The issue is, these bushes are far too high detail and thus cause performance issues (partly because of shadows). A smooth solution to this would possibly be mipmaps, allowing the bushes to become lower resolution when further away from the camera. However, this did not work as anticipated.

Scene with mipmaps (as you can see the sprites further away are blurry): enter image description here

Scene without mipmaps: enter image description here

This is the performance difference. enter image description here

With mipmaps

enter image description here

Without mipmaps

enter image description here

Why is there no performance increase?


Solution

  • Your mipmaps are not the solution for your performance issue. They only reduce the texture resolution of the objects further away. The performance difference is there, but it is not what you expected.

    737 Batches is alot of draw calls batched together.

    To reduce the draw calls and to gain the desired performance boost you have several options:

    • Reduce the Triangle Count. You did not show the wireframe as suggested, but what you want to do for your grass is have a simple square with 2 triangles and use the alpha mask based texture like you already did.
    • Make your material more efficient: for example do not use 2 sided rendering, if you use a shader graph, reduce the amount of processing.
    • Make them grass objects static and bake your lighting. as the renderer will need 1 draw call for the mesh and 1 draw call for the light, this will drastically reduce your draw calls.
    • Additionally, you could also group several grass objects into clusters. Texture them with one material, as each individual material also efeccts your performance.

    To understand the difference between draw calls and batches, read this:

    https://support.unity.com/hc/en-us/articles/207061413-Why-are-my-batches-draw-calls-so-high-What-does-that-mean-

    Very informative forum post on polycount where Joe Wilson shares some knowledge. Worth a read: https://polycount.com/discussion/206507/the-cost-of-a-texture-draw-call-quantity-vs-resolution