[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Gamma correction and texImage2D/texSubImage2D

On Sat, Sep 4, 2010 at 01:42, Adrienne Walker <enne@google.com> wrote:
I agree that the unlit case should ideally behave the same as
rendering to a 2D canvas. However, as Steve points out, this would be
much better implemented as a context creation attribute that the
compositor could respect.  It could default to having gamma correction
turned on.

The canvas 2D context does both actually afaik.

Additionally, if you need a packing flag for texture loads, I think
the most useful operation is the opposite of the one proposed--to
transform non-linear input textures into the appropriate linear space
for lighting.  Using non-linear textures as storage and input arguably
gives you more color resolution in the dark part of the spectrum, so
it might be useful to support that.  D3DSAMP_SRGBTEXTURE is an example
of this sort of texture load flag.

I agree, the more I look at it the more pixel unpacking parameter seems a weird place to do this.
If you have a look at EXT_texture_sRGB extension ( http://www.opengl.org/registry/specs/EXT/texture_sRGB.txt ) it has been resolved that a texture format is the right way to do it.
As Mark already warned about, WebGL should not diverge from what OpenGL does, I'd think it would be preferable, for instance, to support (a subset of) that extension and allow users to specify SRGB8 format on textures they want color correction on (a WebGL implementation can perform the conversion from linear color space before sending actual texture data to ES 2.0 [without that extension] - similar to what it does already when converting to RGB565 and others).