This is the documentation for Enlighten.

Lightmap UV data

The precompute generates lightmap UV data for each radiosity system.

Instance lightmap UVs

To extract the lightmap UV data for all instances in a radiosity system, load the IPrecompPackedSystem object.

// path: "precomp/[system name].pas"
const Enlighten::IPrecompPackedSystem* packedSystem
	= Geo::LoadInterfaceCompressed<Enlighten::IPrecompPackedSystem>(path);

If the instances within this system are lit using probes, the system does not have lightmap UV data and IPrecompPackedSystem::GetOutputWidth returns zero.

Call IPrecompPackedSystem::GetPackedInstances to obtain lightmap UV information for each instance.

Each IPrecompPackedInstance object corresponds to an instance object within the system.

for(Geo::s32 i = 0; i != packedSystem->GetNumInstances(); ++i)
{
	const Enlighten::IPrecompPackedInstance* packedInstance = packedSystem->GetPackedInstances()[i];
}

Call IPrecompPackedInstance::GetInstanceGuid to get the instance GUID and use it to find the corresponding instance object.

Shared lightmap UVs

We recommend to share lightmap UVs between instances that refer to the same geometry object.

To get started quickly, use unique UVs for each instance. To do this, call IPrecompPackedInstance::GetOutputUvArray to obtain pre-transformed lightmap UVs for each instance.

To obtain the shared UV data, load the IPrecompPackedGeometry object.

// path: "precomp/[geometry name].pag"
const Enlighten::IPrecompPackedGeometry* packedGeometry
	= Geo::LoadInterfaceCompressed<Enlighten::IPrecompPackedGeometry>(path);

Use IPrecompPackedGeometry::GetOutputUvArray to obtain shared lightmap UVs, and IPrecompPackedInstance::GetUvTransform to get the UV transform for each instance.

The meshes within IPrecompPackedInstance and IPrecompPackedGeometry are stored in the same order as the geometry object to which the instance refers.

The vertices within the output UV array are laid out in exactly the same way as the vertices in the input mesh.

If you provided each input mesh object with a vertex array laid out the same way as your rendered mesh, you do not need to re-order the vertices in the UV array. To render the mesh with Enlighten lightmaps you can simply add the UV array as a new vertex data stream.

As you extract the UV data, convert it to a persistent form ready to load and render in your game. 16-bit fixed point provides sufficient precision.