I’ve noticed that when merging meshes that contain submeshes the following happens :
-
When mergeSubMeshes parameter is set to FALSE, I need to specify the same amount of materials as there are submeshes. This makes sense to me since each submesh will be renderer using its own material.
-
When mergeSubMeshes parameter is set to TRUE, I can specify one and ONLY ONE material; adding more materials is meaningless. This also makes sense to me since the mesh is now only one mesh, and therefore it will need one material.
Please correct me if I am wrong in any of my assumptions so far as it’s important to me that I understand this basic foundation piece well.
Assuming I was correct, I have a problem with scenario number 2. The problem is that I have a mesh that contains submeshes, and one submesh uses a “Diffuse” shader and all the others use “Bumped Diffuse” shaders. I am attempting to combine all the submeshes into one mesh in order to increase performance, but that is only one side of the equation. The other side is to use as few materials as possible; in this case, the minimum number of materials needed is two : one “Diffuse” material for that one submesh, and one “Bumped Diffuse” material with atlas for all the other submeshes. I’ve done all this, but now I realize that I’m stuck… I can’t seem to get scenario number 2 to work with 2 materials, and from my experiments so far it seems that it will never work, I can only use one material.
Would someone please confirm that what I have said so far is true? If so, what’s the alternative?
Since I’m stuck, I decided to fool around, and I changed the mergeSubMeshes parameter to false (one material for each submesh) and what I did was I filled the materials array with one Diffuse material and filled the rest of the array with references to the same “Bumped Diffuse” material w/atlas, and it worked, but the draw-call count was the same; no improvement whatsoever, I might as well have left my mesh the way it was without any atlases.
So it seems to me that if you have a mesh with several submeshes, every submesh material needs to have the exact same shader or else you can never set mergeSubMeshes to true and merge them into one mesh.


