Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KHR_blend #1302

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions extensions/2.0/Khronos/KHR_blend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# KHR_blend

## Contributors

TODO

## Status

Draft

## Dependencies

Written against the glTF 2.0 spec.

## Overview

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 `KHR_blend` extension, blending must use the
specified blend equation/operation and factors.

For any materials without the `KHR_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": {
"KHR_blend": {
"blendEquation": [32778, 32778],
"blendFactors": [1, 1, 1, 1]
}
}
}
]
```

## glTF Schema Updates

**JSON schema**: TODO

## Known Implementations

TODO
1 change: 1 addition & 0 deletions extensions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down