This is the documentation for Enlighten.

Mesh projection

Mesh projection is a method of generating UVs to allow one mesh to share the lightmap of another nearby mesh. One mesh is designated the target, and the other the detail. The mesh projection produces a set of UVs for the detail mesh that share the same space in the lightmap as the target mesh.

Any number of meshes can be projected onto a single target mesh. Enlighten can treat any number of meshes as a single target mesh, if they're in the same level.

Mesh projection process

The mesh projection process:

  1. generates simplified lightmap UVs for the target mesh in the usual way
  2. forms charts for the detail mesh, but doesn't generate lightmap UVs
  3. chooses the best target mesh chart for each detail mesh chart 
  4. projects each chart onto its target to obtain the lightmap UVs for the detail mesh

Chart alignment

To make sure the detail charts have the correct lighting, the target chart should be large enough to contain the projected charts, as shown below:

If any projected chart is larger than its target chart, the overhanging area of the projected chart will have incorrect lighting.

To prevent incorrect lighting, a boundary between charts in the target mesh should roughly correspond with a chart boundary in the detail mesh. 

The best target chart

For each projected mesh chart, the mesh projection process identifies the closest target mesh chart. Closeness is determined by the distance between the projected vertex and a vertex in the target chart.

The relative orientations of the detail and target surfaces are ignored. This can cause broken lighting when the closest target chart faces in the opposite direction to the projected chart.