Each lightmap texture contains a number of UV chartsIndividual unwrapped section within a UV layout. UV charts are contiguous islands of faces that share a continuous mapping. Their placement determines seams, distortion, and packing efficiency. Also known as a UV island.
See in Glossary. At runtime, Unity maps these UV charts onto mesh faces, and uses the charts’ lighting data to calculate the final appearance. Because of the way GPU sampling works, data from one UV chart can bleed onto another if they are too close to each other. This usually leads to unintended artifacts such as aliasing, pixelation, and so on.
To avoid light bleeding, there must be a sufficient amount of margin between UV charts. When a GPU samples a lightmap texture, the lighting system calculates the final sample value from the four texels closest to the sampled point (assuming bilinear filtering is used). These four texels are called the bilinear “neighborhood” of the sampled point. UV charts are too close together if they overlap — that is, if the neighborhood of any point inside a chart overlaps with the neighborhood of any point in another chart. In the image below, the white pixels indicate chart neighborhoods, and red pixels indicate overlapping neighborhoods.
Determining optimal UV chart placement and spacing can be difficult, because it depends on several parameters (such as lightmap resolution, the mesh’s UV layout, and Model Importer settings). For this reason, Unity provides the ability to identify these issues easily, as outlined in the following section.
There are three ways to identify overlaps:
Keep an eye on Unity’s console. If Unity detects overlapping UVs, it prints a warning message with a list of affected GameObjects.
Use the UV Overlap draw mode in the Scene View (see GI visualizations in the Scene View for more information). When you have this mode enabled, Unity adds a red highlight to texels in UV charts that are too close to texels of other charts. This is especially useful if you discover an artifact in the Scene View, and want to quickly examine whether UV overlap is causing it.
There is no one single solution for UV overlap, because there are so many things that can cause it. Here are the most common solutions to consider: