Suggested maximum size for a combined mesh

Hi everybody,

My project is a 3D action game for mobile (testing in Android now). The scenario is a procedural terrain generated by around 100 pieces. All the pieces share the same material and have a low number of vertices. But some pieces are more complex and break the dynamic batching because they have too many vertices.

My idea has been to combine all the pieces in a single mesh with CombineMeshes. And it works. Now I can have one single big mesh instead of 100 small meshes. The size of the big mesh is around 20000 vertices (and 10000 triangles). I don’t need to worry about the dynamic batching of the terrain pieces. The number of batches (seen in Editor Stats) is smaller now.

I am just worried that 20k vertices is too much for a single mesh in a mobile game. Although my phone (2 years old) can handle it without problems. And my plan is to make bigger terrains (50k in total maybe).

So, in your opinion, is it ok to have a big mesh with 20k or more vertices? or will it be better to have several smaller meshes? For example, combine meshes with a limit of 10k vertices.

Thanks to whoever has an opinion on this matter.

It is completely OK, As long as you do not exceed 65k vertices, you will be fine. Combining meshes into one will only reduce draw calls, thus improving performance.

My understanding: You CAN combine it all into a big mesh, within the limits, but why would you want to? Sure, the polygons that are not in the view frustum will get culled eventually, but it’s better to cull the entire object if it is out of bounds.

I usually divide things like terrain up into large logical “chunks” that are easily culled. Do a test case where you have lots of stuff BEHIND you and in front of you in one big 64K (or whatever) mesh. Then do another with it cut into chunks where many chunks are not visible.

A mesh object is stored as an array of all that data. Why process the whole thing all the time? Unity knows the bounds of the meshes and can cull based on that (object culling). If 3 draw calls are faster than 1 large one…you “win”. If not unity can often batch them for you and will combine them internally (assuming you don’t break batching). If I remember properly, dynamic batches are smaller, though, so you may want to “batch” them yourself. I’d still do it in chunks, though.

This calls for testing in your use-case to see what works best. Various things break batching, for example.

(2 cents)