Prysm comes with a sample demonstrating its HDR capabilities. The sample requires Windows SDK 10.0.18362.0 or newer and DirectX 11. It can be found in the Samples/Common directory.
The sample implements a simple calibration screen. The used Swap Chain is initialized with
RGB10A2 back buffer and a 16-bit texture is used as a render target for Prysm. After the UI is rendered, the final shader performs HDR10 tone mapping on the upper half of the screen where the calibration rectangles are.
The outer rectangle has a color of (12.5, 12.5, 12.5, 1.0) while the color of the one inside can be changed with the “Current Brightness” slider.
The colors in the UI render target are assumed to be in the Rec.709 or DCI-P3 color spaces. The same scene value is expanded from DCI-P3 to Rec.2020 and from Rec.709 to Rec.2020. Then we take linear interpolation between the two expansions. The interpolation factor can be adjusted with the “Color Gamut Expansion” slider.
For the region outside the inner rectangle, we first adjust the HDR contrast by applying a gamma curve based on the “Gamma” slider. Then we normalize the HDR value based on the “PaperWhite Nits” slider so that the color value of 1.0 will correspond to the nits given by the slider.
For the normalized value, we either simply apply the PQ transfer function, if the value is in the range [0, SoftShoulderStart], or we use the Soft shoulder adjustment based on the MaxBrighntessOfTv and MaxBrighntessOfHdrScene. The values can be adjusted with the corresponding sliders.
By default, there is no gamma correction for the inner rectangle but this can be turned on with the “Apply Contrast To Calibration Screen” toggle. Also, in both cases, there is no soft shoulder adjustment for the inner rectangle.
For more information about the theory behind the calibration screen, see the “Calibrating the TV” section of the Hdr Primer.