Simplest function that modify luminance of the color: (0)
$$
T(color) = \frac{color}{ 1 + \frac{luma}{range} }
$$
- T – tone mapping function
- color – be tone mapped
- luma – luminance of color
- range -range to tone map into.
- inverse would be 1 –
Luma – perceived brightness
Luminance standard – 0.2126*R + 0.7152*G + 0.0722*B (1)
Luminance po var 1 – 0.299*R + 0.587*G + 0.114*B (2)
Luminance po var 2 – sqrt( 0.299*R^2 + 0.587*G^2 + 0.1*B^2 ) : SLOW (3)
Approximation:
$$
Y = \frac{(R + R + B + G + G + G)}{6}
$$
$$
Y = (R + R + R + B + G + G + G +G) >> 3
$$
Reduce fireflies:
$$
weight(s) = \frac{1}{ 1 + luma }
$$
- s – samples
Average:
$$
F(average)=\frac{sample * x}{weight(s)x}
$$
- x – number of samples
Expensive function, better results – more than color range linear best for us.
$$
T(color) = \left\{
\begin{array}{l l}
color & \quad \text{if $luma \leq a$}\\
\frac{color}{luma}
\left( \frac{ a^2 – b*luma }{ 2a – b – luma } \right) & \quad \text{if $luma \gt a$}
\end{array} \right.
$$
$$
T_{inverse}(color) = \left\{
\begin{array}{l l}
color & \quad \text{if $luma \leq a$}\\
\frac{color}{luma}
\left( \frac{ a^2 – ( 2a – b )luma }{ b – luma } \right) & \quad \text{if $luma \gt a$}
\end{array} \right.
$$
- 0 to a – linear
- a to b – tone mapped
- if a = 0, b=range – will be the same as first two functions