KhronosGroup / KhronosGroup/WebGL
Add unpackHDRHeadroom attribute for tone mapping
- Dominant language
- HTML
- Stars
- 2.9k
- Forks
- 703
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 4
Description
HDR images can be drawn an infinite number of ways, often unrepresentable as a single bitmap (e.g, gainmap images). There exists a general problem wherein an HDR image must be put into pixels in a buffer. At the moment the HDR image is put into pixels in a buffer, this infinite number of ways of representing it must be collapsed into a single representation.
This problem exists in 2D canvas at `drawImage` time (see [analogous issue](https://github.com/whatwg/html/issues/11165)) and in WebGPU at [copyExternalImageToTexture](https://www.w3.org/TR/webgpu/#dom-gpuqueue-copyexternalimagetotexture) and [importExternalTexture](https://www.w3.org/TR/webgpu/#dom-gpudevice-importexternaltexture) time (see [analogous issue](https://github.com/gpuweb/gpuweb/issues/5236)).
This problem also exists in WebGL at `tex[Sub]Image` time. [This explainer](https://github.com/ccameron-chromium/ColorWeb-CG/blob/master/webgl_hdr_headroom.md) proposes to add an `unpackHDRHeadroom` attribute to `WebGLRenderingContextBase`, indicating the amount of tone mapping (if any) to perform when populating the texture's pixels.
Unlike 2D canvas and WebGPU, WebGL has a few special "opt out of color space conversion" situations (e.g, `UNPACK_COLORSPACE_CONVERSION_WEBGL `). The `unpackHDRHeadroom` attribute will be ignored in the same situations where `unpackColorSpace` is ignored.
Contributor guide
Research direction
Start with the linked webgl_hdr_headroom.md explainer and the WebGLRenderingContextBase entry point, then compare the tex[Sub]Image behavior described in the issue with the existing unpackColorSpace rules. Done means the proposed unpackHDRHeadroom attribute and its interaction with color-space-conversion opt-out cases are specified consistently.
Written by the indexing model from the issue text.
Assessment
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100