[Public WebGL] EXT_sRGB

Thatcher Ulrich [email protected]
Thu Feb 2 07:56:17 PST 2012


On Thu, Feb 2, 2012 at 4:56 AM, Florian Bösch <[email protected]> wrote:
>
> On Thu, Feb 2, 2012 at 3:37 AM, Conor Dickinson <[email protected]> wrote:
>> Are there any plans to add support for the EXT_sRGB extension to WebGL any
>> time soon?
> This extension has not yet been ratified by the OpenGL ES WG. I've
> quickly went over the support for the extension by devices, which
> yielded zero (no device supports this extension yet). It is unlikely
> this would move forward at the current time in WebGL.
>
>> this is the
>> one extension that is currently holding me back from making a top-quality
>> renderer.  I am currently doing sRGB conversion manually into and out of my
>> shaders, but this is inefficient on hardware that supports the extension and
>> it does not handle frame buffer blending correctly.
> You do not have to use sRGB to produce a high quality renderer. There
> are two items you should consider:
>
> Firstly you should consider the importance of being linear (also
> referred to here:
> http://http.developer.nvidia.com/GPUGems3/gpugems3_ch24.html )
> 1) at entry to your application any color input should be converted to
> linear space

FYI the sRGB extensions are preferred, to avoid banding.  Quoting from
that doc:  "Appropriate sRGB formats are defined for all 8-bit texture
formats (RGB, RGBA, luminance, luminance alpha, and DXT compressed),
both in OpenGL and in DirectX. Passing GL_SRGB_EXT instead of GL_RGB
to glTexImage2D, for example, ensures that any shader accesses to the
specified texture return linear pixel values.

The automatic sRGB corrections are free and are preferred to
performing the corrections manually in a shader after each texture
access, as shown in Listing 24-1, because each pow instruction is
scalar and expanded to two instructions. Also, manual correction
happens after filtering, which is incorrectly performed in a nonlinear
space. The sRGB formats may also be preferred to preconverting
textures to linear versions before they are loaded. Storing linear
pixels back into an 8-bit image is effectively a loss of precision in
low light levels and can cause banding when the pixels are converted
back to monitor space or used in further shading."

-T

> 2) Therefore all calculations subsequently done will be correct,
> because they happen in linear space
> 3) Before outputting your result to the screen you convert it to gamma
> space again.
>
> Secondly, it is beneficial (and sometimes required) to be able to
> express more color graduations and wider values than afforded by byte
> textures. WebGL does support floating point textures.
>
> -----------------------------------------------------------
> You are currently subscribed to [email protected]
> To unsubscribe, send an email to [email protected] with
> the following command in the body of your email:
> unsubscribe public_webgl
> -----------------------------------------------------------
>

-----------------------------------------------------------
You are currently subscribed to [email protected]
To unsubscribe, send an email to [email protected] with
the following command in the body of your email:
unsubscribe public_webgl
-----------------------------------------------------------





More information about the public_webgl mailing list