[x3d-public] gamma correction standardization

Andreas Plesch andreasplesch at gmail.com
Wed Nov 25 13:24:24 PST 2015


While exploring differences in rendering between x3dom and cobweb using
http://andreasplesch.github.io/Library/Viewer/x3dweb.html
it becomes quickly obvious that materials in cobweb tend to appear darker
with more contrast. For example the material used in the example scene
below looks more like copper on my screen in x3dom but golden in cobweb.
This difference can be traced back to the use of gamma correction for
lighting purposes in x3dom introduced here:
https://github.com/x3dom/x3dom/issues/222
and further discussed here:
https://github.com/x3dom/x3dom/issues/487

>From what I understand the main point is that although colors in image
files and materials are already gamma encoded and do not need special
treatment for decoding to display on a typical screen, when it comes to
lighting well known equations assume that colors and their intensities are
provided in a linear (non gamma encoded) space. This means that colors in
lighting need to be decoded (linearized) first, then light processed, and
finally re-encoded for delivery to the display system. x3dom does that by
default and has a special environment node attribute to switch off this
kind of gamma treatment (gammaCorrectionDefault="none"). Switched off,
x3dom looks very similar to cobweb; a look which perhaps some regard as
more traditional (?).

These differences point to a need to standardize gamma treatment since
currently the standard seems quiet and allows for quite different
interpretations of how lighting equations are applied.

On the other hand, it may well be that it is out of the scope of the x3d
specification to be more precise about how colors should appear. After all,
the trend is to custom shaders which do their own processing anyways. Is
there a newer or emerged standard shading/material model replacing the
current (Phong?) shading ?

As a first step it would be necessary to determine what assumptions the
lighting equations given in the current standard make in order to claim
that they are somewhat realistic. Are these equations opengl derived ?
Another question is if any other x3d browsers attempt some kind of gamma
correction for shading purposes.

-Andreas

Here is a short example scene, ready to use:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "
http://www.web3d.org/specifications/x3d-3.0.dtd">
<X3D profile='Interchange' version='3.0'  xmlns:xsd='
http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation ='
http://www.web3d.org/specifications/x3d-3.0.xsd '>
<head>
<meta name='title' content='Figure03.08DefaultSphere.x3d'/>
</head>
<Scene>
  <Background groundcolor='0 0 0' />
  <NavigationInfo headlight="false" />
  <!-- uncomment to disable gamma correction in x3dom -->
  <!--
  <Environment gammaCorrectionDefault="none"></Environment>
  -->
  <DirectionalLight direction="0 0 -1" />
  <Viewpoint position="0 0 3" orientation="0 0 0 1" />
<Shape>
<Sphere />
<Appearance>
<Material
              ambientIntensity='0.25'
              diffuseColor='0.384722 0.266993 0'
              specularColor='0.757576 0.738847 0.590386'
              shininess='0.0666667'/>
</Appearance>
</Shape>
</Scene>
</X3D>

-- 
Andreas Plesch
39 Barbara Rd.
Waltham, MA 02453
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20151125/7913fc74/attachment.html>


More information about the x3d-public mailing list