ColorWeb-CG
ColorWeb-CG copied to clipboard
WebGPU, WCG and HDR
The newly created GPU for the Web Working Group develops the WebGPU API, a more modern version of WebGL (raised in #2). The draft spec does not mention "color spaces". Possibly relevant bits of info:
Thanks for raising this, @tidoust
Agree that no mention of the colorspace is a big issue. Is it assumed to be the native display colorspace, so you get different colors on different screens? Surely not.
However, one nice thing I noticed straight away
dictionary GPUColorDict {
required double r;
required double g;
required double b;
required double a;
};
typedef (sequence<double> or GPUColorDict) GPUColor;
so compared to Canvas or the CSS Object Model or the HTML "simple color" (all of which are still stuck in 8 bits per component) using double is a big win there. Enough space for the precision requirements of WCG and probably, depending on how it is defined, HDR as well.
But it does need to be defined:
- what is the range? Nominal 0 to 1 for SDR?
- what is the colorspace (rgbw chromaticities)?
- what is the transfer function ( gamma-encoded or linear)?
- if media (diffuse) white is 1.0 1.0 1.0 then where is highlight white?
How do those colors get mapped to eventual display coordinates for SDR and for HDR displays?
The section in the report needs to be expanded.
I expect that https://github.com/WICG/canvas-color-space/blob/master/CanvasColorSpaceProposal.md will be updated to include this soon (some preliminary notes are at https://docs.google.com/presentation/d/1rvCYKq6T4koS0yRd_C91se6v1h2YJF32pPHtPtBo-R8/edit?usp=sharing).
The presentation today by @ccameron-chromium was very informative regarding the "raw pixel values, do conversion yourself" aspect of WebGPU (and WebGL) compared to the "signal the colorspace for each command, the whole thing is color managed" aspect of 2D Canvas.
Updating this with the planned API. WebGPU has the GPUSwapChainDescriptor
dictionary currently
dictionary GPUSwapChainDescriptor {
required GPUDevice device;
required GPUTextureFormat format;
GPUTextureUsageFlags usage = 0x10; // GPUTextureUsage.RENDER_ATTACHMENT
GPUCanvasCompositingAlphaMode compositingAlphaMode = "opaque";
GPUExtent3D size;
};
We would just add a PredefinedColorSpace
to this.
Has there been any updates on this?
I am working on a revised HDR Canvas strawman based on the feedback I have seen so far:
https://github.com/w3c/ColorWeb-CG/pull/95
The revised proposal focuses on adding baseline support for HDR imagery to Canvas, without precluding future optimizations and extensions. It does so by adding support for HLG and PQ color spaces (which are in widespread use) and 16-bit float samples (which are necessary for HDR).
I would think the same approach could apply to WebGPU (support for HLG and PQ color spaces and bitdepth > 8 bits).