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

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

On Sep 2, 2010, at 7:01 PM, Kenneth Russell wrote:

> In the WebGL specification we've added pixelStorei parameters
> common use cases when uploading images from the browser via texImage2D
> and texSubImage2D. It appears that we are going to need another one to
> determine whether or not gamma correction needs to be applied during
> the image upload. When displaying ordinary images on a web page, the
> browser always performs gamma correction on the image data.
> WebGL applications that want to encode non-image data in images
> definitely do not want gamma correction to be applied; they want the
> verbatim pixel data uploaded. For the display of random web images in
> WebGL applications it is less clear. I don't know whether most 3D
> applications would want to have the gamma-corrected or
> non-gamma-corrected pixels uploaded, and in particular any
> interactions with shading.
> Questions:
> 1. What should the name of the new (boolean) pixelStorei parameter be?
> The name which would most closely match the other parameters would
> probably be UNPACK_CORRECT_GAMMA_WEBGL, where "correct" is a verb.
> However, this name is probably confusing (why would you ever want

I think UNPACK_GAMMA_CORRECTION_WEBGL is clear enough. Even though it's not a verb, it's shorter and I think the idea gets across.

> 2. What should the default value of this flag be? If it were false,
> then for images uploaded from the browser to WebGL, the default
> behavior would be for the pixels to be completely untouched. However,
> this might be surprising behavior to applications displaying images on
> screen with very simple shader code (no lighting) and expecting them
> to look the same as surrounding browser content. Still, I am inclined
> to suggest that the default for the new flag be false to match most
> other OpenGL behavior, where anything other than a pass-through of
> data is optional and disabled by default.

I think it would be useful to have the unlit case behave the same as rendering to a 2D canvas, which would gamma correct. I believe the differences in the lit case would be subtle and it's only if authors are trying to be very precise that they will care. In that case, they can turn it off. But my opinion on this is not strong.


You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email: