This is the documentation for Enlighten.

Per mesh probe lighting


Per mesh probe lighting provides one interpolated irradiance value at the centre of each object's bounding box. All pixels of the mesh are lit by this single irradiance sample.

This approximation limits the effective indirect lighting resolution to one sample per mesh, which provides reasonable lighting accuracy for small meshes.

The runtime cost of this technique increases with the number of objects that use it. In very large scenes with many thousands of objects, this may cause asynchronous radiosity updates to take significantly longer.

To minimize the number of objects, combine nearby groups of small meshes into a single object. 

Per mesh probe lighting with the high level runtime is not compatible with Probe LOD

Manage objects

Use the high level runtime to manage dynamic objects that represent the meshes to be lit using this technique.

To add a new dynamic object, call IUpdateManager::AllocateDynamicObject to allocate the object, followed by IUpdateManager::EnqueueAddDynamicObject.

	Enlighten::DynamicObject desc;
	desc.m_Id = objectGuid;
	desc.m_LocalBoundingBox = objectLocalBounds;

	Enlighten::BaseDynamicObject* object = updateManager->AllocateDynamicObject(desc);
	updateManager->EnqueueAddDynamicObject(object);

Call the property setter BaseDynamicObject::SetTransform after adding the object to set its world transform. 

Every frame, if the object moved since the previous frame, call BaseDynamicObject::SetTransform again to update its world transform.

To obtain the SH coefficients call IUpdateManager::GetDynamicObjectShCoeff.

IUpdateManager::GetDynamicObjectShCoeff produces zeroed output until after the first asynchonous update after the object was added.

	Geo::SHCoeff redCoeffs, greenCoeffs, blueCoeffs;
	updateManager->GetDynamicObjectShCoeff(objectGuid, redCoeffs, greenCoeffs, blueCoeffs);

To remove the object, call IUpdateManager::EnqueueRemoveDynamicObject.

	updateManager->EnqueueRemoveDynamicObject(objectGuid);

Render indirect lighting

When you draw a mesh, use the SH coefficients in your pixel shader to evaluate SH lighting in the direction of the pixel normal.

Light leaks

When an object is close to a wall that separates two areas with very different lighting, probe lighting may appear to leak through a wall. This occurs because lighting is interpolated from probes that are on the other side of the wall.

By default, for dynamic objects, Enlighten uses precomputed probe visibility data to prevent this type of light leak.

This can sometimes cause probe lighting to change suddenly as an object moves.