[x3d-public] X3DOM Documentation: Gamma Correction

Don Brutzman brutzman at nps.edu
Tue Sep 1 09:18:40 PDT 2020


OK thanks.  If I follow your thinking completely, it sounds like we do not want to add to spec yet, rather keep it as a potential system feature.

However, am not understanding rationale.  If gamma correction benefits and context and requirements and solution approaches are all well understood, why aren't we saying anything now in the X3D specification?

In other words, what else would it take to add gamma considerations to X3D?  If X3D rendering is expected to be archival in nature, then it seems essential.  For starters, perhaps something as simple as

==================================================
* X3D Architecture, clause 11 Rendering component
   11.2.5 Gamma Correction

Gamma correction is a nonlinear operation used to encode and decode luminance.

Gamma encoding of images is used to optimize the usage of bits when encoding an image by taking advantage of the non-linear manner in which humans perceive light and color.

It is recommended that X3D browsers support gamma correction for scene rendering whenever appropriate for the display device being used.

==================================================

Also wondering if anyone has written a paper about X3D and gamma correction - not finding any.

Another reference of interest, liberally paraphrased above:

* Wikipedia: Gamma correction
   https://en.wikipedia.org/wiki/Gamma_correction


On 9/1/2020 2:55 AM, Michalis Kamburelis wrote:
> 
> It's a great explanation of how and why gamma works in X3DOM :)
> 
> It was an inspiration for my own reading about gamma (results on https://github.com/michaliskambi/x3d-tests/wiki/Gamma-correction-in-X3D-and-glTF ) and finally implementation of gamma correction in Castle Game Engine ( https://castle-engine.io/manual_gamma_correction.php ).
> 
> Note that in CGE I made a bit different decisions than X3DOM:
> 
> - In CGE, the default is different. We apply gamma by default only on PhysicalMaterial, and we don't apply it on Material and UnlitMaterial. Of course it can be changed (to apply gamma always -- compatible with X3DOM, or never). The explanation how and why is on https://castle-engine.io/manual_gamma_correction.php . I made such default behaviour to keep backward compatibility, otherwise introducing gamma in CGE would change the look of almost all existing models.
> 
>      So, long story short: if you set in CGE "GammaCorrection := gcPhysicalMaterial" (using code, or using view3dscene menu item) than CGE and X3DOM make 100% compatible gamma handling.
> 
> - We don't yet support X3DOM "Environment" node (with "gammaCorrectionDefault" field) because there wasn't much need for it. CGE developers have a simple global variable to adjust it from Pascal. One day I'll add "Environment.gammaCorrectionDefault" support, but it's lower priority now.
> 
> Regards,
> Michalis
> 
> pon., 31 sie 2020 o 22:22 Don Brutzman <brutzman at nps.edu <mailto:brutzman at nps.edu>> napisał(a):
> 
>     Michalis, wondering what you thought about this?
> 
>     https://doc.x3dom.org/tutorials/lighting/gamma
> 
>     "If you know what gamma correction is, you may just want to know that: Lighting in X3DOM can be gamma-correct or not, depending on the Environment node’s gammaCorrectionDefault field. RGB Colors and textures are assumed to be gamma coded. Intensities of all sorts are assumed to be linear. You can use gamma correction with the "gammaCorrectionDefault" attribute:" [...]

all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman



More information about the x3d-public mailing list