Packing takes the existing UVs or the UVs Unity created for you when you select Generate Lightmap UVs in the Import settings, identifies charts, and packs the charts into the light map used for the real-time lighting.
Charts are groups of triangles that share the same vertices. Enlighten
repacks these UVs to ensure that there is no light leaking between charts while also
ensuring that the UVs are packed as tightly as possible. You can see the results of the
packing in the UV Charts mode and also in the
Charting preview, shown in the previous screenshot.
The precompute, run-time memory usage, and the run-time performance of
Enlighten all depend on the number of light map pixels. You can use Enlighten to
generate simplified UVs that deal with complex geometry more efficiently. Simplified UVs
are on by default, but if you carefully crafted your own UVs, you can disable this by
ticking Preserve UVs. You can see the results in
the UV Charts render mode.
The following figure shows this mode with Preserve
Figure 5-4 Wall and TV scene with Preserve UVs
The original UV layout and its charts are all shown in a different color.
Parts of the TV, the wall, and the skirting board all consist of multiple charts,
leading to an overall larger number of charts.
Only enable Preserve UVs if you
have carefully authored UVs that you want to preserve in Unity. In most cases it is best
to not enable this flag.
If Preserve UVs is disabled and the
Auto UV Max Distance set to a small value,
0.01 the packing results look like the
Figure 5-5 Wall and TV scene with Auto UV Max Distance at 0.01
Except for the colors of the visualization, the packing is very similar.
It has roughly the same number of charts, but the unwrapping is slightly different.
The Auto UV Max Distance tells Enlighten what details can be omitted
from the illumination. Enlighten tries to merge charts by creating a UV layout for the
combined charts, but it does not split input charts. The new UV layout is created by
projecting the vertices of all charts considered onto an optimal plane in world space.
Only charts whose world space vertices are not more than the given distance above the
plane are considered for merging.
With the chosen light map resolution, only a few light map pixels are used for
the wall and the floor. This is enough to capture the coarse global illumination of the
scene. You can expect that the fine details are filled in by screen-space ambient
occlusion. The TV and the skirting board on the other hand are so small that they barely
require one pixel, but were allocated far more, because they consist of several charts,
and charts have a minimum size of 4 pixels by 4 pixels.
The following figure shows the result of increasing the distance value to
Figure 5-6 Wall and TV scene with Auto UV Max Distance at 0.5
Enlighten projects the UVs of the TV and the skirting board onto the wall and
floor respectively. They therefore do not require any additional pixels in the light
map. You can clearly see this in the Charting preview. Using even larger values lead to
more details being ignored.
The following figure shows the results of a distance of 2:
Figure 5-7 Wall and TV scene with Auto UV Max Distance at 2
While the light map is even smaller, Enlighten considers the different
parts of the wall, including the corner, to be one segment, with pixels spanning the
different parts. Similar to Auto UV Max Distance, you can define what charts Enlighten
considers for merging based on the angle between triangles. The default value of 89, in
degrees, ensures that Enlighten does not merge charts that are set at a right angle to
each other in world space.