How to achieve best results from Direct2d Tone Mapping Effect

David Howell 20 Reputation points
2024-01-17T15:00:51.47+00:00

Through the use of the Windows Desktop Duplication API and Direct2d, I am trying to take a screen capture of an HDR monitor (10 bits-per-pixel) and create an image in the SDR color space (8 bits-per-pixel). The former API gives me data in the format DXGI_FORMAT_R16G16B16A16_FLOAT. From that, I am trying to use the Direct2d built-in "HDR tone map effect" (CLSID_D2D1HdrToneMap) (https://learn.microsoft.com/en-us/windows/win32/direct2d/hdr-tone-map-effect). It would appear that this effect must be supplemented with the "white tone map effect" (CLSID_D2D1WhiteLevelAdjustment) (https://learn.microsoft.com/en-us/windows/win32/direct2d/white-level-adjustment-effect) in order to achieve good results. I am finding that to be insufficient too. I found an example in GitHub which leverages the "color management effect" (CLSID_D2D1ColorManagement) (https://learn.microsoft.com/en-us/windows/win32/direct2d/color-management) and that helps. Through these 3 effects, I am able to see decent, but not great results. Does Microsoft have recommendations or any sample apps for using these effects? The output I am looking for would be an HBITMAP (via ID2D1Bitmap1). The claim in the tone map effect is that "It's aimed at any framework that wants to provide a best-in-class HDR image viewing experience that handles all of the Windows HDR image formats, and adapts to the capabilities of the display (whether that's HDR or WCG/SDR)." My assumption is that I can obtain SDR pixel data that is "best-in-class".

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,737 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,856 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
10,763 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jeanine Zhang-MSFT 10,536 Reputation points Microsoft Vendor
    2024-01-18T05:35:10.6533333+00:00

    Hello, Welcome to Microsoft Q&A! Tonemapping is inherently a lossy process, and can be optimized for a number of perceptual or objective metrics, so there's no single standard algorithm. For more details, I suggest you could refer to the Doc:Perform the HDR tonemapping operation And you could refer to the sample:Direct2D advanced color image rendering sample Thank you. Jeanine


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.