Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Trees causes performance issues and lots of batches, any idea?

Discussion in 'World Building' started by Gonzasmpl, Jun 27, 2020.

  1. Gonzasmpl

    Gonzasmpl

    Joined:
    Jul 30, 2018
    Posts:
    55
    Hi, I finally decided to learn some procedural generation techniques on world building and now I have a world with thousands of trees that I don't know how to handle haha.

    The "floor" mesh is made of small parts of meshes combined together into one single mesh, to this point it all works fine, with less than 10 batches. The problem came when I decided to add trees to the world, mainly because I believe I can't combine their meshes as you should be able to "cut" those trees and so some trees should be destroyed. That leads to thousands of unique tree meshes and thousands of batches as well (around 4500).

    I have thought of chunks as a workaround to improve a little the performance and reduce the number of batches, but then I thought it may not work well as I am using an RTS camera style and so there would be lots of chunks with trees either way.
    If it helps, I'm using low poly models so no lods are required, and all the trees, bushes, patches of grass, etc. would use the same material.

    I don't know if this is the right subforum for the issue I'm having but I think here should be someone that can help me with some ideas on how to improve performance and reduce batches, also if you know some articles that shares information on this topic I would love to take a read.

    Have a good day, thanks!
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    8,831
    You might look into DrawMeshInstanced or DrawMeshInstancedIndirect to tackle this problem.
     
unityunity