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

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

On 06/09/2010 21:34, Chris Marrin wrote:

But we need to make an assumption if the incoming PNG image omits any color space information. I think it is out of scope to add the ability to let the author choose the color space for these images as they are read in with texImage2D. So do we choose sRGB or linear?
Why is it out of scope? Not doing so violates the PNG spec. I think it is entirely reasonable to provide a way for the application to give WebGL information about the gamma of the samples in the PNG file. Allowing specification of physically linear vs. non-linear covers 98% of use cases.


When using sRGB textures, GL converts the incoming texture data to a physically linear space. When using sRGB renderbuffers, GL converts the blended & multisampled output to the perceptually-linear space of sRGB.
From my reading, incoming textures are not necessarily converted. They may be converted when accessed to preserve more of the color data. In fact, I think the spec recommends doing that to preserve one of the advantages of using sRGB images, to increase the resolution of the dark parts of an image. But I may be misreading.
Conceptually the data is converted to physically linear but since not losing data requires 12-bits per channel, a converted texture needs more memory. So indeed the spec. recommends implementations do the conversion as they read the texels. Filtering can then be done using an enlarged number of bits. The end result is the same.

Sorry for my sloppy language.



fn:Mark Callow
org:HI Corporation;Graphics Lab, Research & Development
adr:Higashiyama 1-4-4, Meguro-ku;;Meguro Higashiyama Bldg 5F;Tokyo;;153-0043;Japan
title:Chief Architect
tel;work:+81 3 3710 9367 x228
tel;fax:+81 3 5773 8660
url:http://www.hicorp.co.jp,  http://www.mascotcapsule.com