Implementing HDR rendering and tone mapping
In all our previous examples, the color values in the framebuffer were always clamped between 0.0
and 1.0
. Additionally, we used 1 byte for each color component in the framebuffer, allowing for only 256 levels of brightness. This limits the contrast ratio between the darkest and brightest areas of the image to 255:1
.
While this may be sufficient for many applications, it poses a problem in scenarios with very bright regions, such as areas illuminated by the sun or multiple light sources. In such cases, values exceeding 1.0
are clipped, and any brightness information above this limit is lost. HDR brightness values preserve these details, improving image realism, and can be mapped back into the 0.0
to 1.0
low dynamic range (LDR) using various tone mapping techniques.
In this recipe, we will walk through setting up HDR rendering and cover all the steps needed to implement a basic tone mapping pipeline.
Getting ready
You can...