Hey!
I am about to implement support for lightmapping in my custom engine, and I have some questions about the UV coordinates used by each lightmapped object. For reference, I looked at how Unity handles this. It seems like Unity prefers to use the second UV map for lightmapping, if there is one. That's fine, I can support arbitrary vertex formats in my engine, however, it is unclear how these UVs are shared (or not) between instances of an object. For example, with Unity (and many other engines) you can apparently lay out the lightmapping UVs yourself in a DCC, such as Blender. Then, when you import the model into Unity you select the option which keeps your UVs rather than generating new ones. My question is, how does this work with more than one instance of that object?
Let's say you have a rock which is used in two different places in the level. Obviously they will need to occupy different places in the light map(s). But what if they are instances of the same mesh which is imported using the “keep my precreated UVs” option? Do they simply get their own lightmap texture or are the lightmap UVs scaled down into "slots" in a lightmap texture or what?
Obviously Unity is closed source, and I don't expect you to know explicitly how it does things, but is there a “defacto standard” for this?
Thanks!