diff --git a/extensions/Khronos/KHR_materials_common/README.md b/extensions/Khronos/KHR_materials_common/README.md index c9341e9277..6626c7ef97 100644 --- a/extensions/Khronos/KHR_materials_common/README.md +++ b/extensions/Khronos/KHR_materials_common/README.md @@ -74,24 +74,24 @@ Table 1. Common Material Shared Properties | `shininess` | `FLOAT` | Defines the specularity or roughness of the specular reflection lobe of the object. | 0.0 | `BLINN`, `PHONG` | | `transparency` | `FLOAT` | Declares the amount of transparency as an opacity value between 0.0 and 1.0. | 1.0 | `BLINN`, `PHONG`, `LAMBERT`, `CONSTANT` | | `transparent` | `boolean` | Declares whether the visual should be rendered using alpha blending. Corresponds to enabling the `BLEND` render state, setting the `depthMask` property to `false`, and defining blend equations and blend functions as described in the implementation note. | `false` | | - -> **Implementation Note**: An implementation should render alpha-blended visuals in depth-sorted order. An implementation should define blend equations and blend functions that result in properly blended RGB and alpha values, such as in the following example: - -``` - functions: { - blendEquationSeparate: [ - WebGLConstants.FUNC_ADD, - WebGLConstants.FUNC_ADD - ], - blendFuncSeparate: [ - WebGLConstants.ONE, - WebGLConstants.ONE_MINUS_SRC_ALPHA, - WebGLConstants.ONE, - WebGLConstants.ONE_MINUS_SRC_ALPHA - ] - } -``` - + +> **Implementation Note**: An implementation should render alpha-blended visuals in depth-sorted order. An implementation should define blend equations and blend functions that result in properly blended RGB and alpha values, such as in the following example: + +``` + functions: { + blendEquationSeparate: [ + WebGLConstants.FUNC_ADD, + WebGLConstants.FUNC_ADD + ], + blendFuncSeparate: [ + WebGLConstants.ONE, + WebGLConstants.ONE_MINUS_SRC_ALPHA, + WebGLConstants.ONE, + WebGLConstants.ONE_MINUS_SRC_ALPHA + ] + } +``` + #### Blinn @@ -100,15 +100,13 @@ When the value of `technique` is `BLINN`, this defines a material shaded accordi This equation is complex and detailed via the ACM, so it is not detailed here. Refer to “Models of Light Reflection for Computer Synthesized Pictures,” SIGGRAPH 77, pp 192-198 [http://portal.acm.org/citation.cfm?id=563893](http://portal.acm.org/citation.cfm?id=563893). -To maximize application compatibility, it is suggested that developers use the Blinn-Torrance-Sparrow model for -`shininess` values in the range of 0 to 1. For `shininess` values greater than 1.0, it is recommended to instead use the Blinn-Phong approximation: +The following code illustrates the basic computation: ``` color = + * al + * max(N * L, 0) + * max(H * N, 0)^ ``` - -where: +where * `al` – A constant amount of ambient light contribution coming from the scene, i.e. the sum of all ambient light values. * `N` – Normal vector @@ -117,6 +115,7 @@ where: * `H` – Half-angle vector,calculated as halfway between the unit Eye and Light vectors, using the equation H= normalize(I+L) +> **Implementation Note**: Writers should be aware about the range of the specular exponent (`shininess`), which is _not_ a normalized range. Concretely speaking, given the above equation, a `shininess` value of 1 corresponds to a very low shininess. For orientation: using the traditional OpenGL fixed function pipeline, the specular exponent was expected to be within [0, 128]. However, using glTF, larger `shininess` values are clearly possible. Blinn shading uses all of the common material properties defined in Table 1. The following example defines a Blinn shaded material with a diffuse texture, moderate shininess and red specular highlights. @@ -158,6 +157,8 @@ where: * `I` – Eye vector * `R` – Perfect reflection vector (reflect (L around N)) +> **Implementation Note**: For the interpretation of the specular exponent parameter (`shininess`), see the section about the [Blinn](#blinn) lighting model. + Phong lighting uses all of the common material properties defined in Table 1. The following example defines a Phong lit material with a yellow diffuse color. ```javascript @@ -315,9 +316,9 @@ Lights are glTF scene objects: they have position and orientation, which can be } } } -``` - -For light types that have a direction (directional and spot lights), the light's direction is defined as the vector (0, 0, -1) and the rotation of the node orients the light accordingly. +``` + +For light types that have a direction (directional and spot lights), the light's direction is defined as the vector (0, 0, -1) and the rotation of the node orients the light accordingly. ### Light Types