-
Notifications
You must be signed in to change notification settings - Fork 511
ToneMapPostProcess
These built-in post-processing shaders are designed to perform tone-mapping of High Dynamic Range (HDR) images for presentation on traditional monitors, as well as the signal generation for HDR10 when outputting to 4k UHD wide gamut displays. See also PostProcess
#include "PostProcess.h"
Construction requires a Direct3D 11 device.
std::unique_ptr<ToneMapPostProcess> toneMap;
toneMap = std::make_unique<ToneMapPostProcess>(device);
For exception safety, it is recommended you make use of the C++ RAII pattern and use a std::unique_ptr
or std::shared_ptr
The shader selection is based on the combination of the tonemap operator and the electro-optical transfer function.
The tonemap operator is controlled by calling SetOperator
:
- None: No tonemap operator is applied, and the input is passed through the shader to the render target unchanged.
- Saturate: A simple clamp to the range 0 to 1 is applied after multiplying by the exposure level.
- Reinhard: The classic Reinhard local tonemap operator is applied after multiplying by the exposure level.
- ACESFilmic: A tonemap operator consistent with the recommended curve for use by the Academy Color Encoding System.
The electro-optical transfer function is controlled by calling TransferFunction
:
- Linear: A simple linear transfer function is applied.
- SRGB: The approximate sRGB display curve (Gamma 2.2) is applied.
- ST2084: A Rec.709 to Rec.2020 color primary rotation and ST.2084 display curve is applied for HDR10 output.
For Xbox One, there is also a
SetMRTOutput
Boolean for selecting special shaders that generate both the HDR10 output for display as well as a tonemapped GameDVR signal using Multiple Render Targets.
-
SetHDRSourceTexture
is used to set the linear texture that provides the original High Dynamic Range (HDR) signal, which is typically in a floating-point format. -
SetExposure
sets the exposure value for the tonemap operators. The default is 0.0 (which is a linear multiplier of 1.0) -
SetST2084Parameter
sets the nits level for paper white when applying the ST.2084 display curve. Reference paper white is 80 nits for a cinema setup, but defaults to 200.0 which is good for typical CRT viewing conditions.
All content and source code for this package are subject to the terms of the MIT License.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.
- Universal Windows Platform apps
- Windows desktop apps
- Windows 11
- Windows 10
- Windows 8.1
- Windows 7 Service Pack 1
- Xbox One
- x86
- x64
- ARM64
- Visual Studio 2022
- Visual Studio 2019 (16.11)
- clang/LLVM v12 - v18
- MinGW 12.2, 13.2
- CMake 3.20