Calling MergeMeshes multiple times yields more efficient results.
I’m not sure if this is a bug, but since it doesn’t behave naturally, I’m reporting it to get your feedback.
For example, suppose there are five meshes, two of which use Material A and the remaining three use Material B.
If you want to merge all of these into a single mesh without changing the appearance, you would typically enable multiMaterials and call MergeMeshes just once.
However, doing this results in a post-merge draw call count of, say, 5.
On the other hand, if you follow the procedure of “first merging meshes with the same material using multiMaterials=false, and then merging the results of each of those merges again using multiMaterials=true,” the final result is the same as the first method (merging everything at once), but the number of draw calls becomes, for example, 2.
Depending on the model, this can dramatically reduce the number of draw calls.
For details, please see repro: Babylon.js Playground
Is this intended behavior?