Is there a tool to merge meshes in the editor?

Godot Version

4.2.2

Question

I am building a scene out of many individual segments, eg. walls, floor, windows etc.
Is there a way to combine these in the editor after I’m done so that there aren’t as many individual meshes and therefor drawcalls?
Other addons or advice are welcome.
Thank you in advance.

When you add meshes to a scene in Godot, the engine turns all the quads of the mesh into triangles. In terms of “draw calls”, the number of meshes is not as important as the number of total triangles being drawn, so making one super mesh may not have the performance savings you’re seeking. But, having many meshes with many different materials each with different textures is where you can bog back down, so if that’s something you want to avoid, you can reduce the number of materials used by your scene with a lot of elbow grease.

This sort of thing is a job for Blender or other 3D graphics tool, and you’re probably going to need to recreate your scene there if this is the road you want to take. You’re going to need to make choices about how all the vertices are joined together in the new mesh, how to texture the new mesh, etc. And while it would be awesome if this was a turn-key feature in Godot, I think that’s too much to ask of a game engine to do for you.

At the very least, I would sit back and think if you really need to do this. I am a premature optimizer, and when I’m making games I have to constantly remind myself of this quote:

“Premature optimization is the root of all evil.” - some famous programmer person

If your scene really is so filled with meshes that you’re noticing performance drops on your target platform, then by all means start thinking about a way to solve those problems. But if there is no problem, I’d say keep working on game features and worry about optimization later.

2 Likes

Thank you for the advice. I’ve definitely seen me procrastinate by optimizing useless stuff instead of working :slight_smile:

1 Like

Just wanted to add a few things, a draw call a combination of the mesh and the materials on it, so any combination of those 2 things would be the same draw call if batching is going on, whether dynamically or using some instancing setup.

So take a mesh you have, say a teapot, you have 100 of them on the screen.

  • If all of those meshes have the same exact material on them, and they are batched, they are considered 1 draw call.

  • If half of those meshes have material A on them, and the other half of those meshes have material B on them, then after batching it will be 2 draw calls.

Example here where I have 10 objects as mesh instances, there are two mesh shapes, a box and a sphere, and two materials, green and red, and I did a mixture of combinations as you can see.

Without doing anything (at least in 4+), the draws show 10 objects but 4 draw calls, so it’s doing some dynamic call batching but it still considers it 10 objects.

Now if you do an instancing setup using the multimesh instance node, where the 4 of those you see have those 4 combinations of mesh and material, but there are more than one instance of that combo that matches the unique objects you see above.

Eliminating object count is always important to, so the MeshInstance3D setup helps a ton with that too, it’s just not the easiest to implement when you are actively working on your set dressing.

Merging meshes can work, but that can be a memory hog as well as slowing down any loading times and instantiation times, especially if you are streaming in areas at runtime.

1 Like

Wow, thanks a lot!

1 Like