Blend
Combines two textures with a blend mode, like layer modes in an image editor.
Outputs
| Name | Type | Description |
|---|---|---|
| Texture Output | Texture | The blended result. |
Inputs
| Name | Type | Description |
|---|---|---|
| Foreground | Texture | The top layer. With nothing connected it counts as black. |
| Background | Texture | The bottom layer. With nothing connected it counts as black. |
| Mask | Texture | Where the blend applies. Its red channel goes from 0 for the plain background to 1 for the full blend. With nothing connected the blend applies everywhere. |
Parameters
| Name | Type | Description |
|---|---|---|
| Output Format | Enum | Whether the output takes the size and type of the foreground, of the background, or of the settings below.Choices: Copy Input A, Copy Input B, Manual |
| Texture Type | Enum | The channels of the output texture. Follows an input unless the output format is Manual.Choices: R (u8), RG (u8), RGBA (u8) |
| Texture Size | Vector 2 Int | The size of the output texture in pixels. Follows an input unless the output format is Manual. |
| Blend Mode | Enum | How the foreground is combined with the background.Choices: Over, Add, Subtract, Multiply, Divide, Average, Difference, Screen, Darken, Lighten, Overlay, Hard Light, Soft Light, Exclusion, Color Dodge, Color Burn |
| Blend Alpha | Bool | Whether the blend mode is applied to the alpha channel too. When off, the alpha is combined as in Over. |
| Input A Swizzle | String | Rearranges the channels of the foreground before blending, as four letters from R, G, B, A, 0 and 1. |
| Input B Swizzle | String | Rearranges the channels of the background before blending, in the same way. |
Blend puts one texture over another the way layer modes do in an image editor. The foreground is the top layer and the background the bottom one. Over is ordinary layering, where the foreground covers the background as far as its alpha lets it. Every other mode combines the two colors channel by channel. Multiply darkens, Screen and Add lighten, Difference shows where the two differ, and Overlay, Hard Light and Soft Light add contrast in the way their namesakes do in image editors.
The mask limits where the blend happens. Where the mask is white the blended result shows, where it is black the plain background shows, and gray gives a mix of the two. A gradient in the mask fades one effect into the other across the image.
The swizzles rearrange the channels of an input before it is blended. Each is four letters that say what goes into red, green, blue and alpha, from the input’s own R, G, B and A or a fixed 0 or 1. RRRA turns an input into a gray image from its red channel, and RGB1 makes it fully opaque.
With only one of the two textures connected, the other counts as black. With neither connected the output is empty.
Keywords: composite, layer, over, multiply, screen, add, overlay, mask, mix