HDR Lighting

Lighting in the real world contains a very high dynamic range (HDR) of luminance values. The real world has about 10 orders of dynamic range (DR) for luminance values spread across the spectrum of darkness to brightness. On the other hand, a computer screen has a very limited display gamut (or range of luminance values): approximately two orders of dynamic range. The challenge to producing HDR rendered images is to map the real world HDR values into the limited gamut of a computer screen.  Generally, the motivation for HDR rendering can be summarized in three points: 1) bright things can be really bright, 2) dark things can be really dark, and 3) details can be seen in both.

low dynamic range lighting (LDR)

Awakening's HDR supports includes below features:

1. 64-bits Back Buffer

Use the HDRMode() function to change back buffer format.

2. 64-bits Render Target

Add "Render Target 64-bit" in Texture Panel.

3. 64-bits Light Map Texture

Set light map texture format in Light Map Option dialog.in general

4. Multiple HDR Texture Formats supports

Decoding & Encoding HLSL functions and HDR Format Convert.

5. HDR Shader Files

include\hdrformats.fx, post\hdr.fx, post\down_sample_4x4_*.fx, post\calc_adapted_lum.fx, etc.


In general, use following steps to achieve HDR lighting:

1. Turn on 64-bits Back Buffer

Use the HDRMode(1) function to set back buffer format to A16B16G16R16F .

2. Repeat scale down scene image until to 1x1 image ( count Average Scene Luminance )

A example flow path:

    1) First use a use a none shader Post copy current scene image to a 64 x 64 texture ( 64~1 all size images must be 64-bits ).

    2) down_sample_4x4_64.fx ( output to 16 x 16 image ) down_sample_4x4_16.fx ( output to 4 x 4 image ) down_sample_4x4_4.fx ( output to 1 x 1 image )

3. Expose 64-bits scene image by Average Scene Luminance

    1) First use calc_adapted_lum.fx to calculate luminance to another 1 pixel texture.

    2) use hdr.fx to map high dynamic range data to 0~1 range.