Search Unity

DrawCall optimization - CombineMeshes with multiple materials still worth?

Discussion in 'General Graphics' started by AnthonyPaulO, Nov 4, 2019.

  1. AnthonyPaulO

    AnthonyPaulO

    Joined:
    Nov 5, 2010
    Posts:
    110
    Hello World!

    Haven't touched Unity since 3.0 so getting my beak wet with all the new features. Just to shake off some rust I've written a basic Minecraft type world and doing it proper by dynamically generating a single mesh per chunk as well as dynamically generating texture atlases. However, I have to deal with multiple materials as (using the Standard shader) dirt will be rendered Opaque and glass (transparent) will be rendered Fade, and some blocks will have different values of Metallic, for example. Back in the day I would do this via multiple sub-meshes and use CombineMeshes (setting mergeSubMeshes to false since I need to use multiple materials). For all of you veterans that have had to do this at one time or another, am I saving much here, is this optimization still worth the hassle? My understanding is that multiple-materials breaks static batching anyway so I'm curious as to what we're saving. What would you suggest? Looking for advice from people that have actually gone through this process.

    One thing I'm considering is the super-shader approach, that is, combine everything into one shader so there's one material, but then I'd have to worry about integrating new shaders into a single shader as I come across different needs.

    Many thanks in advance!
     
    Last edited: Nov 4, 2019