This is the documentation for Enlighten.

Level of detail and baking

Introduction

If your scene uses multiple level of detail (LOD) meshes in a geometry object then the baking API will use this information to ensure that these objects do not self-shadow between different LODs. Different mesh LOD levels do not have to have their own lightmap but can do so by making use of the per-mesh lightmap functionality.

HLBS scene markup

Baking uses the same geometry as the precompute, and so shares the same .geom XML format. Adding lmName and lmType attributes to each <mesh> tag is usually the best way to get lower level of detail lightmaps to use a lower resolution.

Sample scene

In this scene there are two objects with level of detail information. There are two objects of interest, each composed of a pyramid (high LOD) and a cube (low LOD). Clearly these are not good examples of level of detail meshes, but show the effect quite clearly. GeometryA is on the left, and has an invisible low detail LOD used as the target mesh (cube) and a single detail mesh (pyramid). GeometryB is on the right, with a visible low detail LOD used as the target mesh, and a high detail LOD as a detail mesh.



GeometryA.geom
<geom id="" name="GeometryA" version="3">
	<mesh name="pCubeShape1" filename=".\pCubeShape1.pim" lmName="GeomA" lmType="64x64" direct="true" indirect="true" target="true" lodLevel="-1" />
	<mesh name="pPyramidShape2" filename=".\pPyramidShape2.pim" lmName="GeomA" lmType="512x512" direct="false" indirect="true" target="false" lodLevel="0" />
</geom>

GeometryB.geom
<geom id="" name="GeometryB" version="3">
	<mesh name="pCubeShape1" filename=".\pCubeShape1.pim" lmName="GeomB" lmType="64x64" direct="true" indirect="true" target="true" lodLevel="1" />
	<mesh name="pPyramidShape2" filename=".\pPyramidShape2.pim" lmName="GeomB" lmType="512x512" direct="false" indirect="true" target="false" lodLevel="0" />
</geom>

The scene then specifies the two halves of a u-shaped box for the world, and places GeometryA and GeometryB instances. Each instance has a defined lmName attribute, and this is combined with any lmName attributes at mesh level to give the final lightmap name. See Per-mesh lightmaps.

<scene name="LevelOfDetail" version="1">
	<instance name="ubox_left" systemId="1" paramSet="Interior" geometry="ubox_left" type="Radiosity" lmName="A" lmType="512x512" position="-1000.0 0.0 0.0" rotation="0.0 0.0 0.0 1.0" />
	<instance name="GeometryA" systemId="1" paramSet="Interior" geometry="GeometryA" type="Radiosity" lmName="GA" position="-1000.0 -500.0 0.0" rotation="0.70710678 0.0 0.0 0.70710678" />
	<instance name="ubox_right" systemId="2" paramSet="Interior" geometry="ubox_right" type="Radiosity" lmName="B" lmType="512x512" position="1000.0 0.0 0.0" rotation="0.0 0.0 0.0 1.0" />
	<instance name="GeometryB" systemId="2" paramSet="Interior" geometry="GeometryB" type="Radiosity" lmName="GB" position="1000.0 -500.0 0.0" rotation="0.70710678 0.0 0.0 0.70710678" />
</scene>

Combining the lightmap names from instance and mesh gives us 6 final lightmaps created, these are:

Lightmap generated

Geometry

Mesh

A_512x512

ubox_left

All

B_512x512

ubox_right

All

GA_GeomA_512x512

GeometryA

Pyramid

GA_GeomA_64x64

GeometryA

Cube

GB_GeomB_512x512

GeometryB

Pyramid

GB_GeomB_64x64

GeometryB

Cube

Final output