[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] Linear-to-sRGB conversion to the drawing buffer using sRGB extension
The way this is done is that with the original sRGB extension
you can specify the pixel format of framebuffer that is being drawn to. Unfortunately WebGL only exposes the FBO portion of that functionality, because WebGL lacks a way to precisely specify the framebuffer that it draws to.
If you wanted to add that functionality to WebGL you're going to run into a problem that the browsers compositor is not operating in linear space. The canvas is an FBO attached texture, and if it where to be in sRGB format, the compositor would attempt to read out the color, get linear, and splat that to screen unmodified. So if you where to add a way to specify the canvas framebuffer, you also need to touch up the browsers compositor to do the right thing (either re-encode to sRGB or whatever colorspace it uses when it reads from sRGB, or use an sRGB framebuffer itself and let the window compositor do the right thing).
So long story short is, there's presently no way to do it in WebGL, and adding a way may turn out to be more complex than assumed, so what you've got to do is re-encode the linear value manually to sRGB for output. Though the enclosing browser may use a different colorspace and sRGB may not be the right colorspace to output (we also lack color management in WebGL, but I digress).