Less meshes with more submeshes or the other way around - does it matter?

Generic question - is there any reason (especially from the performance point of view) to have less game objects grouped together using the same material(s) over more objects (with the same material(s))?

Imagine having a model consisted of five buildings (all using the same material). Does it make sense to have them grouped into one mesh or it would be the same having them all as separate meshes?

I think it is almost always better to have 1 submesh and 1 material per object. If you have multiple submeshes, you should usually bake them together into 1 with 1 material.

And for buildings, having them as separate objects means that they can be culled. If it is one object, all will be rendered even if an edge of 1 building is visible.

I suggest to read up on batching and culling

It’s one of those ‘it depends’ problems… Like marking everything static.
What needs to be rendered - CPU
Render that - GPU

More meshes makes it easier to send less stuff to the GPU to render it like DevDunk said, but the CPU does do more work to sort that.
So depends if you are constrained on either the CPU or GPU, you might consider making life harder on one to ease the other.

Is that also the case if 1 model has multiple submeshes? I think each submesh will be a batch

The pipeline you are using is probably a huge factor to consider. Also the type of mesh. Skinned or static?

When using SRP batching and skinned meshes I’ve found it is highly beneficial to combine them into a single mesh with multiple submeshes, one for each material. The overhead of processing each skinned mesh is pretty extreme so anything I can do to reduce that count helps and with the SRP material count is pretty irrelevant as long as I’m reusing the same shader as much as possible.

EDIT: I noticed that you gave the example of one material. In that case, DevDunk is right: Just combine them into a single mesh if you can. It’ll be less work for the engine in all possible ways.

1 Like