This is the documentation for Enlighten.
Advanced techniques
Separate sky and bounce
Enlighten indirect lighting can look flat and washed out when it contains both sky lighting from above and sun bounce from below. To prevent this, use the environment visibility factor to apply sky lighting separately from bounce.
The images below show combined sky and bounce on the left, and separate sky and bounce on the right.
The cliff wall is mostly indirectly lit, and uses probe lighting. There is strong sunlight bounce from below, and strong sky lighting from above. With combined sky and bounce the cliff appears lit from no specific direction. The cliff wall appears to glow in an unnatural way. With separate sky and bounce the cliff appears brightly lit from below by yellow bounce from the sun, and also brightly lit from above by blue sky.
To apply sky lighting separately:
- When adding a system, probe set or cubemap to the high level runtime, do not call SetEmissiveEnvironment.
- In the pixel shader, multiply the unoccluded sky lighting by the environment visibility factor.
To compress an environment visibility factor while preserving accuracy for small values, for example to save space in the G-buffer, convert to gamma 2.0 space and store as a single byte UNORM.
For per pixel probe lighting, generate environment visibility data and compute the environment visibility factor for the surface normal:
- In the Radiosity parameters, set the probesParameterSet envVisShNumCoefficients to SH_ORDER_L1.
- Create a fourth PPPI atlas texture with the same format as the R, G and B atlas textures.
- When compiling PppiAtlasUpdate.hlsl and PppiCommon.cg, #define PPPI_ENVIRONMENT_VISIBILITY.
- Before rendering, bind the fourth atlas texture in the same way as the R, G and B atlas textures.
- To compute the environment visibility factor in the pixel shader, evaluate the SH function for PppiSample::EnvironmentVisibility in the same way as for the R, G and B channels.
We recommend to use FP16 for the fourth PPPI atlas texture to prevent seams that can occur when an integer format is used.
For lightmap lighting, the environment visibility factor is the fourth component of the radiosity normal texture.
Mesh area light proxies
To get precise control over area light sources, the artist can create a special proxy mesh to be used as an area light source. In this scenario, we want the surface to emit light with full contribution, but not reflect or block incoming light. To achieve this, when the artist has marked the material as a a special area light source, set both indirectTransparency
and indirectReflectivity
to one. To prevent secondary bounces from the area light geometry, assign surfaces using the material a black (zero) albedo.
For this type of material that will emit bright light at runtime, set isEmissive=true. This can boost the accuracy of emissive lighting particularly for small emissive surfaces.
High quality radiosity
When the cost of Enlighten radiosity computation is not a priority, such as for offline rendering, you might want to boost the quality of the output. This would normally be done at the same time as increasing the indirect lighting resolution.
budget: The number of irradiance form factors to store. Increases runtime memory and cpu.
this attribute is named irradBudget when used in a parameterSet element.
quality: The number of rays to cast for computing irradiance form factors. Increases precompute time.
this attribute is named irradQuality when used in a parameterSet element.
Radiosity-only cubemap output
Enlighten provides the option to generate radiosity-only cube map output which can be composited with high frequency material albedo and direct lighting information in your engine on the GPU. This low-frequency indirect lighting output is analogous to the irradiance output from Enlighten's system solver and could be computed at a lower resolution than the final cube map with which it is composited. The images below shows a visualisation of radiosity-only cube map output.
To enable radiosity only cubemap output in the high level runtime, construct UpdateManagerWorkerProperties with m_ComputeRadiosityOnlyCubeMaps set to true and call IUpdateManager::EnqueueSetWorkerProperties.
Albedo and Radiosity | |
---|---|
Radiosity only |