Combine multiple MeshInstance3D into one MeshInstance3D for optimization

Godot Version

Godot_v4.3-stable_win64

Question

Is it possible to combine multiple MeshInstance3D, with different shape and materials to one mesh for optimization? im making minecraft-like game and want to combining far objects and blocks to one mesh, but blocks and objects near the character will be individual meshes and because of that I can build and destroy them.

I thought multimesh would help, but the tutorials talk about one object (like grass or a tree) that’s placed in large numbers and combined into a Multimesh. but I need to combine different objects and blocks.

using gridmaps not an ideal solution. its good for blocks, but other objects can have any position and can’t be at specific cell.

Multimeshes are meant for several instances of the same mesh (which can have different appearances through shader).

If you are doing a minecraft-like game you should look into voxel-terrain generation.

If you are interested, i have a script which allows to merge meshes (several instances of the same) into one multimesh, which is only useful if you place your meshes by hand