How do these practices effect Lightmapping in game engines?

I'm curious how these practices:
- reducing vertices by creating long thin triangles
- mirroring the UVs

...effect Lightmapping in a game engine like Unity? I'm under the impression that long thin tris and overlapping UVs cause issues with Lightmaps? Any thoughts on this?

Much thanks!

  • Jonathan Lampel replied

    Hey, great question! That is indeed true, and there are tradeoffs either way - you only need one set of UV's if the UV's work for lightmaps, but to get them to work you'll end up reducing the texel density of your textures and adding extra geometry. For the most part it's better to create a second UV map specifically for lightmapping.  Here's a good writeup for further reading

    Typically a light map requires each mesh to have a second set of UV texture coordinates, where every surface that will receive lighting needs to have its own unique space within the 0-1 UV square. 

    To help reduce the number of rendering batches, it is best to combine a bunch of meshes together into the same light map, giving each mesh its own UV space as needed. Often a game level is divided up into a sequence of light maps, each covering either a geographic area or a combination of props used throughout the level.

    Some people create the light map UVs with an automatic unwrap & pack algorithm. Automatic unwrapping is faster and easier to create but it tends to waste more texture space, so the light map pixels end up larger on the model, the lighting is more blurry. 

    Time-permitting, for the best results it is best to start with a copy of the texture UVs (if they're good), unmirror any mirrored parts that need unique lighting, un-overlap any overlaps that need unique lighting, and scale up the UVs for areas that need greater lighting detail. Then pack them all into the 0-1 UV square with appropriate Edge  padding space between the UVs. 

    When an artist manually tunes the UVs by overlapping/mirroring parts they know will receive identical lighting, and scaling up areas that have higher-frequency shadows, this allows the light map to have a higher apparent texture resolution. If overlaps are used, they should be moved at least 1 unit outside the UV square to avoid rendering errors when the lighting is baked. 

    If you have a mesh that has UV's that won't work well for lightmapping in Unity, you can choose Generate Lightmap UV's in the mesh import settings, and you'll be good to go. 

    1 love