The purpose of the tone-mapping function is to map the wide range of high dynamic range (HDR) colors into low dynamic range (LDR) that a display can output.
This is the last stage of post processing that is done after the normal rendering during post processing. The process of tone mapping can be thought of as a way to simulate the response that film has to light.
Once installed, select the camera of the scene and add the component ‘Tonemapping’. When you add it you will see something like:
With ‘Strength’ (1) you can select the strength of the effect. Select the type of tonemapping you want to use in ‘Operator’ (2). You can choose between these:
- Linear: it does not apply any transformation.
- Logarithmic: apply the logarithm function in base 10 to the luminance.
- Exponential: like the previous one but using the exponential function.
- Simple Reinhard: a faster version of the algorithm proposed by Erik Reinhard.
- Luma Reinhard: another variation of Reinhard’s algorithm based on luminance.
- White Luma Reinhard: Reinhard based on luminance, but white preserving.
- Hejl 2015: ACES-liked, proposed by Jim Hejl.
- Filmic: a filmic tonemapping.
- ACES: based on ‘ACES Filmic Tone Mapping Cuve‘ by Narkowicz in 2015.
- ACES Oscars: a pastel hue function, designed to provide a pleasing albedo.
- Lottes: based on ‘Advanced Techniques and Optimization of HDR Color Pipelines‘ by Timothy Lottes (AMD) in 2016.
- Uchimura: from ‘HDR theory and practice‘ by Hajime Uchimura in 2017. Used in ‘Gran Turismo‘.
- Unreal: Used in Unreal Engine 3 up to 4.14. Adapted to be close to ACES, with similar range.
- Uncharted 2: Created by John Hable for ‘Uncharted 2‘ (based on Haarm-Pieter Duiker’s works for EA).
- Watch Dogs: Used in ‘Watch Dogs‘ by Ubisoft.
- PieceWise: ‘Piece-Wise Power Curve’ by John Hable at Epic Games.
Depending on the operator you choose, you may have some extra options that will appear in (3).
The next thing you can configure is the color. ‘Exposure’ (4) affects the overal brightness. ‘Color filter’ (5) tints the color. ‘Saturation’ (6) and ‘Vibrance’ (7) affects the color balance. With ‘Contrast’ (8) you can change the color contrast in log space, which fixes the clamping in the blacks.
You can also modify the ‘Lift’ (9), ajust shadows for RGB, the ‘Gamma’ (11), ajust midtones for RGB, and the ‘Gain’ (13), ajust highlights for RGB. With (10), (12) and (14) you can adjust the brightness of each parameter.
Finally, by pressing (15) you can access the online help and in ‘Reset’ (16) to return to the default parameters.
All code is inside the namespace ‘Nephasto.TonemappingAsset’ and main component is ‘Tonemapping’. So if you want to use it you must first import its namespace:
If ‘myCamera’ is a valid camera and you want to add the effect, you should do something like:
For more information, see the documentation in the ‘Tonemapping’ class and the attached demo.
Any questions or suggestions you have, I will be happy to answer you in