TorqueShaderEngine/LightingSystem/High Dynamic Range Lighting

From TDN

Introduction

This section explains the Torque Lighting System's implementation of HDR (High Dynamic Range Lighting) and DRL (Dynamic Range Lighting), and how to configure and get the best results from them.

Contents


What are HDR and DRL?

At their foundations HDR (High Dynamic Range Lighting) and DRL (Dynamic Range Lighting) are ways to automatically control the scene's exposure. The systems adapt to variations in scene intensity in much the same way the human eye or a camera does; reducing exposure when lighting intensity is high, and increasing exposure when lighting intensity is low.

The difference between HDR and DRL is in the precision used for calculating and adjusting the scene. HDR uses high precision floating point buffers to store and process scene images, providing a better overall image quality and allowing darker scenes to be adjusted without visual artifacts. DRL uses much faster integer buffers, which can create lower image quality, but work on a wider range of hardware.

HDR and DRL Features

The scene's HDR/DRL is controlled by the Sun, which can be edited using the Mission Editor. There are several parts to the system: DRL, HDR, Bloom, and Tone Mapping, each with its own controls.

DRL controls the scene exposure adjustment using the following properties:

DRLTarget - intensity level the scene will be adjusted to.
DRLMax - maximum amount the exposure can increase.
DRLMin - maximum amount the exposure can decrease.
DRLMultiplier - allows post-processing exposure adjustment.

HDR is dependent on DRL and requires it to be enabled. HDR uses the DRL settings to adjust scene exposure, but uses higher precision floating point buffers for image processing.

Bloom is independent of DRL/HDR and can be used with or without it. Bloom provides glow to scene areas that exceed a set intensity level and is controlled using the following properties:

bloomCutOff - scene areas above this intensity bloom (bloom is sampled before DRL and uses the scene's original intensity).
bloomAmount - strength of bloom.
bloomSeedAmount - strength of bloom center.

Tone Mapping requires either DRL or Bloom to be enabled. The Torque Lighting System's Tone Mapping implementation allows full screen dynamic cinematic filtering, which adjusts the scene's tone based on intensity levels - simulating film color balance (see Cinematic Filtering for details). This adds considerable depth to the scene.

Users can disable parts of the HDR/DRL system using the following prefs:

$pref::LightManager::sgUseDRLHighDynamicRange - disables HDR falling back to DRL.
$pref::LightManager::sgUseDynamicRangeLighting - disables the entire HDR/DRL system (including Bloom and Tone Mapping).

HDR and DRL Specifics

HDR requires floating point blending support on the target video card. This feature is generally related to pixel shader 3.0 support, though some ps 3.0 capable cards don't support it (nVidia 6200 for one).

Even with the higher precision HDR is still sensitive to large exposure increases. Try to avoid extremely dark areas or cap the max exposure to a reasonable level.

DRL requires pixel shader 2.0 or higher.

Designing Scenes for HDR and DRL

Scenes using HDR or DRL should be designed with each fallback level in mind (HDR falls back to DRL, and DRL falls back to normal rendering), as hardware limitations and user prefs allow these to be disabled.

Each fallback level has its own design considerations and a balanced scene combines all of these.

HDR is the most flexible, but as mentioned above try to avoid large exposure increases. Also do not overexpose the original scene (make sure there is no overexposure with DRL and Bloom off) - it causes washed out areas even when the system reduces the exposure. Instead use the system itself to create the exposure.

DRL is the same as HDR, but more sensitive to exposure increases.

Normal rendering can be difficult to balance with HDR/DRL - though these systems operate best with normal to underexposed scenes, that exposure level looks extremely bland when rendered normally. At the same time the overexposure that makes normally rendered scenes pop, causes washed out areas in the HDR/DRL system. The ideal scene balances these getting bright and vibrant results from both.

Regardless of the rendering always use well balanced textures and avoid heavy contrast between them.