aest 0.1.0
Collection of C++ utility libraries
Loading...
Searching...
No Matches
aest::colors::tonemap Namespace Reference

Tonemapping operators, from HDR linear light to the 0-1 range of a display. More...

Functions

constexpr double rrt_and_odt_fit (const double value)
 Rational fit of the ACES RRT and sRGB ODT curve, by Stephen Hill.
template<LinearRGBSpace Color>
constexpr Color reinhard (const Color &color)
 Reinhard tonemapping, c / (1 + c) on each channel.
template<LinearRGBSpace Color>
constexpr Color reinhard_extended (const Color &color, const float white)
 Extended Reinhard tonemapping, c (1 + c / w²) / (1 + c) on each channel, which maps white to 1.
template<LinearRGBSpace Color>
constexpr Color aces_fitted (const Color &color)
 Fitted ACES tonemapping by Stephen Hill: an approximation of the ACES Reference Rendering Transform and sRGB Output Device Transform.

Variables

constexpr Matrix3 ACES_INPUT
 Input matrix of the ACES fit by Stephen Hill: linear sRGB to the ACES AP1 primaries, with the saturation step of the RRT folded in.
constexpr Matrix3 ACES_OUTPUT
 Output matrix of the ACES fit by Stephen Hill: back from the ODT to linear sRGB, with the saturation step of the ODT folded in.

Detailed Description

Tonemapping operators, from HDR linear light to the 0-1 range of a display.

Function Documentation

◆ aces_fitted()

template<LinearRGBSpace Color>
Color aest::colors::tonemap::aces_fitted ( const Color & color)
constexprexport

Fitted ACES tonemapping by Stephen Hill: an approximation of the ACES Reference Rendering Transform and sRGB Output Device Transform.

The fit is defined on linear sRGB, so the color is converted to LinSRGB, mapped, clamped to [0, 1] and converted back: colors outside the sRGB gamut clip, as the fit targets an sRGB display. It raises contrast and desaturates highlights, like the full ACES transforms. Alpha is kept.

Template Parameters
ColorA linear RGB space
Parameters
[in]colorThe HDR color
Returns
The tonemapped color, in the sRGB gamut with channels in [0, 1].
See also
BakingLab

Definition at line 111 of file Tonemap.cppm.

◆ reinhard()

template<LinearRGBSpace Color>
Color aest::colors::tonemap::reinhard ( const Color & color)
constexprexport

Reinhard tonemapping, c / (1 + c) on each channel.

Every channel goes from [0, ∞) into [0, 1), so the result never clips, but white is reached only at infinity. Working per channel, it also desaturates bright colors toward white. Alpha is kept.

Template Parameters
ColorA linear RGB space
Parameters
[in]colorThe HDR color
Returns
The tonemapped color, every channel in [0, 1).
See also
Reinhard et al.

Definition at line 65 of file Tonemap.cppm.

◆ reinhard_extended()

template<LinearRGBSpace Color>
Color aest::colors::tonemap::reinhard_extended ( const Color & color,
const float white )
constexprexport

Extended Reinhard tonemapping, c (1 + c / w²) / (1 + c) on each channel, which maps white to 1.

Channels from 0 to white go into [0, 1]; brighter ones go above 1 and clip when encoded. Pick white as the brightest value of the scene, or the peak of the display over REFERENCE_WHITE_NITS. Alpha is kept.

Template Parameters
ColorA linear RGB space
Parameters
[in]colorThe HDR color
[in]whiteThe linear value that becomes 1
Returns
The tonemapped color.
Precondition
white is greater than 0.
See also
Reinhard et al.

Definition at line 87 of file Tonemap.cppm.

◆ rrt_and_odt_fit()

double aest::colors::tonemap::rrt_and_odt_fit ( const double value)
constexpr

Rational fit of the ACES RRT and sRGB ODT curve, by Stephen Hill.

Parameters
[in]valueOne channel, after ACES_INPUT
Returns
The tonemapped channel, before ACES_OUTPUT.

Definition at line 45 of file Tonemap.cppm.

Variable Documentation

◆ ACES_INPUT

Matrix3 aest::colors::tonemap::ACES_INPUT
constexpr
Initial value:
= {{
{0.59719, 0.35458, 0.04823},
{0.07600, 0.90834, 0.01566},
{0.02840, 0.13383, 0.83777},
}}

Input matrix of the ACES fit by Stephen Hill: linear sRGB to the ACES AP1 primaries, with the saturation step of the RRT folded in.

Definition at line 24 of file Tonemap.cppm.

◆ ACES_OUTPUT

Matrix3 aest::colors::tonemap::ACES_OUTPUT
constexpr
Initial value:
= {{
{1.60475, -0.53108, -0.07367},
{-0.10208, 1.10813, -0.00605},
{-0.00327, -0.07276, 1.07602},
}}

Output matrix of the ACES fit by Stephen Hill: back from the ODT to linear sRGB, with the saturation step of the ODT folded in.

Definition at line 34 of file Tonemap.cppm.