[x3d-public] [x3dom-developers] gamma correction standardization
Don Brutzman
brutzman at nps.edu
Wed Dec 9 08:26:56 PST 2015
Thanks for the discussion of this important topic.
At a minimum this is a candidate capability for X3D v4.
Gamma correction has been added to our "Candidate capabilities"
http://www.web3d.org/wiki/index.php/X3D_version_3.4_Development#Candidate_capabilities
Editorial note: v3.4 efforts are all being promoted to v4.0, we are not pausing for an intermediate version. 8)
This was a major topic early on, with Maureen Stone and others. It will be great to revisit and consider what improvements can be practically pursued. Appreciate your "looking" at the right challenges! 8)
On 11/26/2015 5:09 PM, Andreas Plesch wrote:
> Hi Max,
>
> thanks for the clarification. I found this article referred to in the github issue helpful:
>
> http://http.developer.nvidia.com/GPUGems3/gpugems3_ch24.html
>
> It argues convincingly for the kind of gamma correction which x3dom does but is not generally adopted with opengl fixed pipeline apps.
>
> It may be that opengl fixed pipeline lighting was formulated without considering in what kind of color space colors/intensities would need to be provided to the pipeline but implicitly assuming a linear space ? This is just a guess. If this is the case, then indeed the gamma correction discussed in the article and applied in x3dom would be preferable, eg. lead to colors which are truer to their appearance outside of the pipeline.
>
> Although there might not be a large appetite for x3d to have an opinion on gamma correction since it would likely complicate browser programming and would need to be somehow backward compatible, I thought it still is something to be at least aware of.
>
> -Andreas
>
>
> On Wed, Nov 25, 2015 at 11:59 PM, Limper, Max <max.limper at igd.fraunhofer.de <mailto:max.limper at igd.fraunhofer.de>> wrote:
>
> Hi Andreas,
>
> I think the current lighting equations match well with the fixed function pipeline from traditional OpenGL. Modern renderers for games, for example, use physically-based shading (PBS) models, which are a bit more realistic than the (not energy-preserving) phong model.
>
> AFAIK, however, there is no commonly used, standardized model for PBS parameters (yet).
>
> Regards,
> Max
>
> Am 25.11.2015 10:25 nachm. schrieb Andreas Plesch <andreasplesch at gmail.com <mailto:andreasplesch at gmail.com>>:
> 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
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
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