Hey, I have been tinkering with some procedural marching cubes rendering, and I am currently drawing a single material to the screen. Now, however, I want to increase it to multiple materials, which brings up the problem of optimization. I have been reading up on this matter, and the best way to do this seems to be using different meshes per material, as far as I can see. (Please correct me if there is a better way)
My first conclusion was that if you calculated the mesh for each chunk only when a voxel is changed, then stitched the different chunks’ meshes together on a per-material basis (so that I have a total of one mesh per material), it would be more efficient than having hundreds of meshes depending on the number of materials and chunks. I thought that every time a chunk’s mesh is updated, it would simply be saved then added to the per-material mesh, so that you could have a low number of meshes without having to recalculate the entire mesh (just adding the precomputed other chunks) So, before I go ahead and add in the multiple material function, I wanted to come here and ask for some quick advice/tips on whether this would work.
Finally, the other way I thought is to combine the chunk meshes for each material into a few slightly larger meshes, (such as 4x4 chunks) instead of combining them into one large mesh.
So, am I looking at this process wrong? Is there a better way to mesh batch multiple materials in this setting than I have come up with?