UDN
Search public documentation
LightMapUnwrapping
Unwrapping meshes for light-maps
Document Summary: Light-maps have special constraints on the UV coordinates they use. This document explains those constraints. Document Changelog: Initial version.Mirror over the texture's X axis
This affects both light-map textures and vertex light-maps. Light-maps store lighting for three different directions, and blend between them based on the actual normal per-pixel. The three directions are fixed in tangent-space, so in world-space they will be mirrored the same as the texture coordinates. The directions that are used are only symmetric over the texture's X axis. To ensure that the same directions in world-space are used on both sides of the mirror seam, UV map the mesh so the mirroring seam is as close to vertical as possible. Using the same world-space directions on both sides of the mirror seam is important because the accuracy of the light-map depends on them. If different directions are used, the light-map will be less accurate on one side of the seam, which can result in a visible seam in the light-map. The tangent basis is built from the first UV set, so those are the texture coordinates which need the mirroring to be on the texture's X axis.Split the light-map UVs for the mirrored pieces
The mesh's light-map UVs need to be separated by a few texels at a mirror seam. This is necessary because the texels from the two halves can't be blended together; and if they're close that can occur due to the smoothing filter applied to light-maps, or bilinear texture filtering. Looking at the wall mesh from Torlan as an example you can see that texture space was saved by mirroring most of the normal map over the x axis
The second UVW coordinates used to generate the lightmap information would normally have a clean unique unwrap such as below.
To avoid the seam ingame the mirrored half should be selected...
and then split where the mirrored section is on the texture...
then when the asset is viewed ingame you will not get the seam you would have gotten previously...
you will instead get the result you intended and still save texture space.
Where to place padding
With Lightmass, padding around the edges of the lightmap UV layout is no longer necessary. Lightmass automatically pads by one texel to prevent bleeding artifacts, so any additional padding done in the uv layout will result in wasted lightmap memory.
Padding between UV charts (groups of triangles with contiguous UV's, there are two in the image above) is still necessary. The amount of padding between UV charts depends on the lowest resolution that will be used on the mesh. There needs to be about 4 lightmap texels between UV charts to avoid all artifacts, so for a lightmap resolution of 32, the padding between UV charts should be 12.5% of the entire UV space. However, the more padding you put between UV charts, the more lightmap memory will be wasted with higher resolution lightmaps.
