I was wondering: is there any performance difference between using a stock lightmapping system on a multi-material object vs. using a custom lightmapping shader for each of materials on that object, assuming that in both cases you are using identical UV2 and identical lightmap covering whole object?
To think of it: there is probably no way to apply a lightmap to a multi-material object in one pass except if you use another duplicate mesh with one hidden lightmap material and then blend it with the main object - and yeah, no way it happens like that. So, most likely, how stock lightmapping works is this: there is a hidden lightmap texture slot in compiled shaders that gets filled per-material by the lightmapping system and sampled later. If that’s the case, performance should be identical to my approach, with only difference being that I must assign lightmaps to materials manually.
P.S.: To clarifty: the reason to use custom lightmapping in the first place is ease of use/prefabs. It’s much more convenient when the lightmap can be treated as just another texture (albeit 32-bit one), stored neatly in level-independent folders and easily saved to prefabs.
I think you understand the default implementation correctly. Lightmapping is really just sampling a texture (or textures) and putting the result into the right part of the lighting equation. If your custom shader does the same, then it’s likely the same cost. If your solution supports blending multiple lightmaps together, then that will be more expensive than the default shader (which only reads one set of lighmaps). Certainly, though, blending two sets of lightmaps in the shader will be much cheaper than rendering an object twice and alpha blending the second pass.