[Public WebGL] gamma/color profile and sRGB

Rik Cabanier [email protected]
Fri Nov 21 16:25:17 PST 2014


On Fri, Nov 21, 2014 at 12:19 AM, Florian Bösch <[email protected]> wrote:

> On Thu, Nov 20, 2014 at 11:36 PM, Kenneth Russell <[email protected]> wrote:
>
>> How would an API like this work in the browser? The browser's window
>> can be dragged from screen to screen, changing the answer this API
>> returns.
>>
> You could have a canvas.addEventListener('gammaRamp', function(ramp){...})
> which triggers whenever the majority of the canvas finds itself on a
> different display.
>
> The browser is supposed to transform colors specified in the sRGB
>> color space ( http://www.w3.org/TR/css3-color/ ) to the display's
>> color profile. In practice, only Safari and IE handle this correctly
>> today, and they rely on the OS's colorspace support to do so. There's
>> an ongoing effort in Chrome to handle multiple displays' color
>> profiles correctly, and to do so on all operating systems. Not sure
>> about work in this area in Firefox.
>>
> There's two things to do actually.
>
>    1. Make sure that no color space conversion is applied if the WebGL
>    context returns plain values. This would make roll-your-own colorspace
>    handling easier.
>    2. Make sure that the correct color space conversion is applied if the
>    WebGL context does return in sRGB (for which we're currently lacking any
>    mechanism)
>
> For WebGL 2.0 I think a new context creation attribute is needed to
>> let the application allocate an sRGB back buffer. The browser's
>> compositor would handle that differently when drawing it to the
>> screen.
>
>
Isn't everything that the browser composites defined to be in sRGB?
SVG filters do some tricks where they allow linear space, but that's still
linear sRGB


> More guidance from experts in colorspace handling is needed.
>>
>
> We've had the discussion on explicit drawing buffer creation a while ago
> (in a different context). Where it partained to attaching a context to
> different drawing buffers, which would be quite useful. Does the canvas CR2
> spec handle this case by now? Could we have an interface to explicitely
> create drawing buffers? It would sometimes be useful to be able to draw on
> different drawing buffers with different attributes (for testing and other
> things).
>

AFAIK Canvas image pixels are always defined to be in sRGB. If you draw an
image with a different profile, the pixels are supposed to be mapped from
that profile to sRGB before compositing. you should be able to prove that
using the image from [1]

1: http://ie.microsoft.com/testdrive/graphics/colorprofiles/default.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://khronos.org/pipermail/public_webgl_khronos.org/attachments/20141121/7c11533a/attachment.html>


More information about the public_webgl mailing list