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

[Public WebGL] Gamma correction and texImage2D/texSubImage2D



In the WebGL specification we've added pixelStorei parameters
UNPACK_FLIP_Y_WEBGL and UNPACK_PREMULTIPLY_ALPHA_WEBGL to handle
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
"incorrect" gamma?). UNPACK_PERFORM_GAMMA_CORRECTION_WEBGL?

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.

-Ken
-----------------------------------------------------------
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: