This is the documentation for Enlighten.

Mesh projection troubleshooting


When you share a lightmap between two meshes using mesh projection, the lighting for the projected detail mesh will usually match the target mesh.

When a projected chart is larger than the chosen target chart, the overhanging area of the projected chart will have incorrect lighting.

By default, mesh projection avoids creating lightmap UVs for the detail mesh that refer to an uninitialized area of the lightmap by clamping vertices or extrapolation.

Clamping vertices

The image below shows a lightmap UV layout that is the result of mesh projection. The single target chart is shown in black, and the projected charts are shown in red. The topmost projected chart has an overhanging area.

By default, the UV coordinates for areas of the projected chart are clamped to the bounds of the target chart. When you render the detail mesh, lighting for the overhanging regions is sampled from the clamped location.

When the overhang is less than size of a lightmap pixel, clamped overhangs produce no noticeable difference in the lighting. Larger overhanging areas may appear obviously incorrect under some lighting conditions.

Lighting extrapolation

The image below shows a lightmap UV layout that is the result of mesh projection. All vertices of the red projected chart lie within the target chart.

This chart has an overhanging area that cannot be clamped. In this scenario, when you render the detail mesh, lighting for the overhanging regions is sampled from an area in the lightmap outside the target chart. To prevent this, Enlighten will extrapolate the lighting by creating additional lightmap pixels for the overhanging area.

When the overhang is less than size of a lightmap pixel, extrapolated overhangs produce no noticeable difference in the lighting. Larger overhanging areas may appear obviously incorrect under some lighting conditions.

Visualizations

To prevent incorrect lighting, the artist can avoid large overhanging areas. To help identify the overhanging areas, use the Projection Issues visualization service in GeoRadiosity. This mode displays overhanging pixels in a bright blue colour.

You can also implement the same visualization within your editor with the Debugging Utilities API.