Merged meshes, multimaterials, and draw call counts

Is there a way to merge cloned meshes, where the original mesh has a multimaterial, and keep the draw call count constant (ie. independent of the number of clones that got merged)?

In the playground, everything is working as expected. I clone 5 cubes, each with 2 materials. If I merge with multiMultiMaterials false, there is 1 draw call (but 1 material). If I merge with multiMultiMaterials true, there are 10 draw calls (2 per pre-merged cube).

I’m hoping to find a way to merge them all into one mesh (still with 2 materials) and have 2 draw calls for the entire merged mesh.

Would using instances instead of merging meshes work for your use case? I tried modifying your example with instancing and it keeps the multimaterial while having few draw calls :smiley:


Thanks for the idea! Yes it does work. In practice I have a few hundred instances, but I was able to put them as children of a transform node and manipulate that.

I’d still be interested to know if there’s a way to do it with merged meshes.

could help, maybe
It optimizes the draw call number by sorting the geometry under the hood after the merge (the solid particles addition)

1 Like