w3c / ColorWeb-CG

repo for the Color on the Web Community Group
47 stars 21 forks source link

Application tone mapping in HDR Canvas API #79

Open donmccurdy opened 2 years ago

donmccurdy commented 2 years ago

In the use cases and examples described by the "Canvas High Dynamic Range" proposal, I'm mostly reading descriptions of how to display existing HDR content, such as images and video. Use of the proposal for image formation in computer-generated imagery (CGI) and physically-based rendering (PBR) is not explicitly discussed. Consider a mixed 3D scene with various objects and light sources, resulting in an image that benefits from wider dynamic range.

Is this roughly an intended workflow for such applications?

  1. Application render pass outputs pixels to frame buffer in open domain [0, ∞], float-16, Linear-sRGB1
  2. Application tone mapping pass applies a view transform (e.g. Filmic), output is again open domain [0, ∞], float-16, Linear-sRGB, with high intensity values significantly compressed
  3. Depending on device / platform capabilities:
    • a. For SDR display, output to canvas with mode = 'default', pixel values in closed domain [0,1] sRGB
    • b. For HDR display, output to canvas with mode = 'extended', sRGB, pixel values in open domain [0, ∞] sRGB

Does this seem correct? In particular, I assume such an application will often want to avoid having a generic tone map performed by the platform or display device, as in the rec2100-pq and rec2100-hlg cases? Is it possible to output to a wider color gamut like P3, without enabling one of these two HDR color spaces? I only see extended sRGB discussed here, not extended Display P3, and do not know if there are active plans to bring Display P3 to WebGL.


1 Definitions:

palemieux commented 8 months ago

@donmccurdy See the proposed rec2100-display-linear space at https://github.com/w3c/ColorWeb-CG/blob/feature/add-mastering-display-info/hdr_html_canvas_element.md .

donmccurdy commented 8 months ago

Thank you! I think I will need to learn more about how tone mapping is implemented for an HDR display, my steps 1-3 above do not feel quite correct to me now. But that is probably outside scope here.

Availability of rec2100-display-linear sounds helpful!

What does the "display" term in rec2100-display-linear / rec2100-linear-display[^1] refer to? I think I would have expected this predefined colorspace to be rec2020-linear, if it's linear with rec 2020 primaries, but I have probably missed something.

[^1]: Current draft refers to both, likely a typo.

palemieux commented 8 months ago

What does the "display" term in rec2100-display-linear / rec2100-linear-display1 refer to?

The display qualifier emphasizes that the component signals are display-referred, i.e., R = G = B = 1 means 203 nits on the Rec. 2100 reference display.