Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Official Cross Platform HDR Display Support in 2023, and a new HDR Calibration sample project

Discussion in 'General Graphics' started by dnach, Jun 15, 2023.

  1. dnach

    dnach

    Unity Technologies

    Joined:
    Mar 9, 2022
    Posts:
    90
    Greetings from the Graphics team!

    We are glad to announce that as of Unity 2023.2.0a18, the Unity Editor and Standalone Players now provide cross-platform support for HDR output, along with full compatibility with the Universal and High Definition Render Pipelines.

    A new sample project is now available, demonstrating how to implement an HDR Calibration menu for your application. Such menus allow players to optimally configure the application's minimum and maximum brightness according to their display's capabilities.

    High Dynamic Range (HDR) displays are becoming increasingly available, and are capable of reproducing images with higher peak brightness and wider color gamut, in order to achieve better contrast (highlights/shadows) and color saturation. This results in more realistic variations in luminance across scenes, increased surface detail and improved depth perception.


    HDR Gamut View - The larger triangle represents the Rec.2020 color space

    Before sharing more information on how to enable HDR output, and how to implement an HDR calibration menu for your project, let’s quickly review the concepts of HDR rendering and display.

    HDR Rendering and Display in Unity

    When enabling HDR Rendering, the camera will render the scene to a floating point framebuffer, allowing the render pipeline to store a larger range of color values and thus better preserve detail. Shader calculations, such as lighting and post processing, are performed using more accurate values (compared to SDR rendering), thus leading to more convincing and realistic results.

    While HDR rendering has been the default workflow for years, a lack of HDR-enabled display will limit the presentable image’s color depth to a maximum of 8 bit per channel, thus limiting the maximum number of colors a pixel can represent (maximum of 16,777,216 different color values) along with the maximum brightness range. As such, HDR->SDR tone mapping is used in order to remap the color buffer’s HDR values into a low dynamic range, and optionally apply gamma correction, before finally writing the results into the swapchain image for presentation.


    Applying HDR tone mapping (ACES mode)
    Unity 2022.1 introduced HDR display support for the High Definition Rendering Pipeline, when targeting desktop and console platforms. This was followed by Universal Render Pipeline support for desktop and console platforms in 2022.2.

    HDR output works by setting the device native color space when creating the swapchain, and using custom HDR tone mapping in order to remap the color buffer’s content into the display native HDR range. HDR encoding is then applied as a final step, before writing to the HDR swapchain image.

    With HDR output enabled, the swapchain image format is set to enable a higher color depth (either 10 or 16 bits per channel). This allows each pixel to represent a much wider range of possible color values (roughly 1 or 68 billion different color values) and a greatly increased brightness range.

    With the release of Unity 2023.2.0a18, the Unity Editor and Standalone Players now provide full HDR tone mapping and display support, across all rendering pipelines and capable platforms.

    Enabling HDR Display in your project

    The new HDR Display settings can be found in the project’s Player Settings, under Edit > Project Settings > Player > Other Settings :
    • Allow HDR Display Output
    • Use HDR Display Output
    These settings will enable HDR output for Unity standalone players, as well as the editor, when running on supported platforms.


    With HDR output enabled, you can optionally configure the "Swap Chain Bit Depth" in order to set a lower (10 bit per channel) or higher (16 bit per channel) preferred color depth for the presented image. Note: not all devices support 16 bit buffer formats, and may fall back on 10 bit instead.

    When using the Universal Render Pipeline, ensure that the Render Pipeline Assets in use are set to enable HDR rendering. Select the RP assets included in the project (generally found under the Assets > Settings folder), then navigate to the project inspector and enable Quality > HDR:


    Lastly, ensure that HDR tone mapping is enabled by adding a tonemapping component to post-processing volume affecting your cameras. When HDR output is enabled, the following tone mapping settings should be driven by the display’s HDR capabilities:
    • Minimum supported brightness.
    • Maximum supported brightness.
    • Paper White value: This value represents the brightness of a paper-white surface represented on the display, which determines the display's brightness overall.
    You can access the display’s HDR range and paper white value using the following C# API: https://docs.unity3d.com/2023.2/Documentation/ScriptReference/HDROutputSettings.html


    For more detailed information on HDR tone mapping and output, as well as platform support, please refer to the updated documentation for HDR Output in URP and HDR Output in HDRP.

    You can read more about various guidelines and limitations in the following blog post: https://blog.unity.com/engine-platform/cross-platform-hdr-display-support

    (Updated 10.11.2023)
    HDR Calibration Sample:

    For an optimal viewer experience, we recommend providing runtime control over the HDR output settings via a designated HDR calibration interface.

    New sample projects are now available, demonstrating the implementation of an HDR calibration menu for both the Universal and High Definition Render Pipelines. The sample projects illustrate how players can optimally configure the min/max brightness and paper-white values, in order to avoid under/overexposure and to ensure that text is fully legible:


    This is achieved with the help of a few reference HDR images, which showcase a combination of bright (outdoor) and dark (indoor) environments. When implementing your own HDR calibration screens, it is advised to show case the brightest and darkest environments in your application.

    The sample includes a full-screen (grayscale) min/max calibration screen, in order to assist users with the configuration of HDR tone mapping values:


    In addition to a calibration menu, the sample project provides a pop-up screen which prints the HDR display settings and information made available by the HDROutputSettings API. This includes the device and display's HDR capabilities, swapchain image format, min/max brightness and paper white values:


    Lastly, the sample also includes useful reference on how to correctly setup Camera Stacking when enabling HDR output.

    You can obtain the new HDR calibration sample project via the following download link, or by cloning the official repository: https://github.com/Unity-Technologies/HDR-Calibration-Sample

    Please refer to the included readme file for instructions on how to setup and use the sample project: https://github.com/Unity-Technologies/HDR-Calibration-Sample/blob/main/README.md

    ------------------------------------------------------------------------------------

    Please give the new HDR display support and sample projects a try, and let us know what you think!

    Your feedback has been instrumental so far as it helps us prioritize the most meaningful solutions. Please check out our public roadmap to vote on the features that best suit your needs. If there are additional changes you’d like to see, feel free to submit a feature request, or contact the team directly in the graphics forum and in this thread.
     
    Last edited: Nov 14, 2023
    sacb0y, DevDunk, c0d3_m0nk3y and 4 others like this.
  2. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    928
    What is the correct method for toggling HDR at runtime?
     
  3. sacb0y

    sacb0y

    Joined:
    May 9, 2016
    Posts:
    928
    Also, for anyone who happens upon this I created a HDR demo project to help people get familiar with what HDR is and how it works. Currently made on Unity 2022.3
    https://momoirosoft.itch.io/hdr-demo
     
    mahdi_jeddi and dnach like this.
  4. dnach

    dnach

    Unity Technologies

    Joined:
    Mar 9, 2022
    Posts:
    90
    An official HDR Calibration sample project is now available, demonstrating the implementation of an HDR calibration menu for both the Universal and High Definition Render Pipelines.

    Please check the updated post at the beginning of this thread for more information!
     
    sacb0y likes this.
  5. dnach

    dnach

    Unity Technologies

    Joined:
    Mar 9, 2022
    Posts:
    90