From 0f28140f89c5147a511b603b60516fb7004d34d1 Mon Sep 17 00:00:00 2001 From: Don McCurdy Date: Fri, 30 Mar 2018 21:40:02 -0700 Subject: [PATCH 1/2] Add EXT_blend extension --- extensions/2.0/Vendor/EXT_blend/README.md | 96 +++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 extensions/2.0/Vendor/EXT_blend/README.md diff --git a/extensions/2.0/Vendor/EXT_blend/README.md b/extensions/2.0/Vendor/EXT_blend/README.md new file mode 100644 index 0000000000..b5c1918c9c --- /dev/null +++ b/extensions/2.0/Vendor/EXT_blend/README.md @@ -0,0 +1,96 @@ +# EXT_blend + +## Contributors + +TODO + +## Status + +Draft + +## Dependencies + +Written against the glTF 2.0 spec. + +## Overview + +This extension defines blending operations on glTF materials. The `EXT_blend` +extension may be used alongside the default PBR materials, or materials defined +in glTF extensions. When combined with other materials and techniques, blending +may be used to achieve effects like fire, steam, or holograms. + +For any material with the `EXT_blend` extension, blending must use the +specified blend equation/operation and factors. + +For any materials without the `EXT_blend` extension, blending is assumed to be +off unless otherwise specified. + +### Properties + +**blendEquation** :white_check_mark: + +Determines how a new pixel is combined with a pixel already in the frame buffer. + +* **Type:** `number` `[2]` + - `0` *color* equation + - `1` *alpha* equation +* **Required:** Yes +* **Allowed values:** + +| name | blendEquation | description | +|--------------------------|---------------|-------------| +| FUNC_ADD | 0x8006 | Set an addition blend function. | +| FUNC_SUBTRACT | 0x800A | Specify a subtraction blend function (source - destination). | +| FUNC_REVERSE_SUBTRACT | 0x800B | Specify a reverse subtraction blend function (destination - source). | +| MIN | 0x8007 | Produces the minimum color components of the source and destination colors. | +| MAX | 0x8008 | Produces the maximum color components of the source and destination colors. | + +**blendFactors** :white_check_mark: + +Defines parameters to the blending equation. + +* **Type:** `number` `[4]` + - `0` : *source color* multiplier + - `1` : *destination color* multiplier + - `2` : *source alpha* multiplier + - `3` : *destination alpha* multiplier +* **Required:** Yes +* **Allowed values:** + +| name | blendFactor | description | +|---------------------|-------------|-------------| +| ZERO | 0 | Turn off a component. | +| ONE | 1 | Turn on a component. | +| SRC_COLOR | 0x0300 | Multiply a component by the source's color. | +| ONE_MINUS_SRC_COLOR | 0x0301 | Multiply a component by one minus the source's color. | +| SRC_ALPHA | 0x0302 | Multiply a component by the source's alpha. | +| ONE_MINUS_SRC_ALPHA | 0x0303 | Multiply a component by one minus the source's alpha. | +| DST_ALPHA | 0x0304 | Multiply a component by the destination's alpha. | +| ONE_MINUS_DST_ALPHA | 0x0305 | Multiply a component by one minus the destination's alpha. | +| DST_COLOR | 0x0306 | Multiply a component by the destination's color. | +| ONE_MINUS_DST_COLOR | 0x0307 | Multiply a component by one minus the destination's color. | + +### Example + +```json +"materials": [ + { + "name": "My_Additive_Material", + "pbrMetallicRoughness": {}, + "extensions": { + "EXT_blend": { + "blendEquation": [32778, 32778], + "blendFactors": [1, 1, 1, 1] + } + } + } +] + ``` + +## glTF Schema Updates + +**JSON schema**: TODO + +## Known Implementations + +TODO From a570d453eb6d74b46ce69970b33a3395de1c7e01 Mon Sep 17 00:00:00 2001 From: Don McCurdy Date: Tue, 3 Jul 2018 11:14:05 -0700 Subject: [PATCH 2/2] Rename EXT_blend -> KHR_blend. --- .../{Vendor/EXT_blend => Khronos/KHR_blend}/README.md | 10 +++++----- extensions/README.md | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) rename extensions/2.0/{Vendor/EXT_blend => Khronos/KHR_blend}/README.md (94%) diff --git a/extensions/2.0/Vendor/EXT_blend/README.md b/extensions/2.0/Khronos/KHR_blend/README.md similarity index 94% rename from extensions/2.0/Vendor/EXT_blend/README.md rename to extensions/2.0/Khronos/KHR_blend/README.md index b5c1918c9c..988abac23c 100644 --- a/extensions/2.0/Vendor/EXT_blend/README.md +++ b/extensions/2.0/Khronos/KHR_blend/README.md @@ -1,4 +1,4 @@ -# EXT_blend +# KHR_blend ## Contributors @@ -14,15 +14,15 @@ Written against the glTF 2.0 spec. ## Overview -This extension defines blending operations on glTF materials. The `EXT_blend` +This extension defines blending operations on glTF materials. The `KHR_blend` extension may be used alongside the default PBR materials, or materials defined in glTF extensions. When combined with other materials and techniques, blending may be used to achieve effects like fire, steam, or holograms. -For any material with the `EXT_blend` extension, blending must use the +For any material with the `KHR_blend` extension, blending must use the specified blend equation/operation and factors. -For any materials without the `EXT_blend` extension, blending is assumed to be +For any materials without the `KHR_blend` extension, blending is assumed to be off unless otherwise specified. ### Properties @@ -78,7 +78,7 @@ Defines parameters to the blending equation. "name": "My_Additive_Material", "pbrMetallicRoughness": {}, "extensions": { - "EXT_blend": { + "KHR_blend": { "blendEquation": [32778, 32778], "blendFactors": [1, 1, 1, 1] } diff --git a/extensions/README.md b/extensions/README.md index 32cd85b978..98b0aa7551 100644 --- a/extensions/README.md +++ b/extensions/README.md @@ -3,6 +3,7 @@ ## Extensions for glTF 2.0 #### Khronos extensions +* [KHR_blend](2.0/Khronos/KHR_blend/README.md) * [KHR_materials_pbrSpecularGlossiness](2.0/Khronos/KHR_materials_pbrSpecularGlossiness/README.md) * [KHR_materials_unlit](2.0/Khronos/KHR_materials_unlit/README.md) * [KHR_draco_mesh_compression](2.0/Khronos/KHR_draco_mesh_compression/README.md)