Table Of Contents
Introduction
This shader facilitates 'Photoshop'-style texture blending of stacked texture 'layers', complete with a comprehensive set of Porter-Duff alpha coverage overlay modes, and is typically used for decal effects or adding dirt/grime. The output of this shader can be chained with other Color Layer shaders to bypass the eight layer slot limit.
Redshift decal texture overlaying a brick texture
General Parameters
Advanced Overlay Options
Enables 'advanced' options that gives you more control over how the layers are overlayed and how alpha affects the blending of the layers. When disabled it is assumed that alpha is pre-multiplied into the base and layer textures and the desired Overlay Mode is the commonly used 'Over' technique.
Base Layer
Color
This is the base color of the layered texture. All subsequent 'layers' will be applied on top of this.
Color Has Premultiplied Alpha
This option informs the shader whether or not the base layer color texture has alpha pre-multiplied into it, which is often the case with 8-bit textures, or if this is the output of a chained Color Layer shader.
It is crucial that this option is set correctly for correct overlay blending to occur, particularly when chaining Color Layer shaders. Not doing this can yield unexpected results.
Layer 1 - 7
There a seven layers that are 'overlayed' on top of each other, each with their own blending and overlay techniques.
Enable
This option enables a layer to be blended on top of previous layers. This option should be disabled when the layer is not used.
Color
This is the color of the layer texture that is to be blended with the previous layers.
Mask
This is an optional texture mask that can be used to affect the alpha of the layer that is being blended. It can be used as a straight up binary mask, or for adjusting the layer transparency.
Blend Mode
This controls how the color of the layer is blended with the color of the previous layers. The 'Photoshop'-style color blending options are are as follows:
- Normal
- Average
- Add
- Subtract
- Multiply
- Difference
- Lighten
- Darken
- Screen
- Hardlight
- Softlight
- Burn
- Dodge
- Overlay
- Exclusion
- Divide
Blend Mode in Detail
In the following examples there are only two texture layers in use, the base layer is the Redshift logo and Layer 1 is the multicolored Redshift text. Both textures have their out alpha connected to their respective layers alpha slot. The only thing that changes between each example is the Layer 1 Blend Mode.
|
|
Base | Layer 1 |
This example's shader graph.
|
|
|
|
|
Normal | Average | Add | Subtract | Multiply |
|
|
|
|
|
|
|
|
|
|
Difference |
Lighten |
Darken |
Screen |
Hardlight |
|
|
|
|
|
|
|
|
|
|
Softlight | Burn | Dodge | Overlay | Exclusion |
|
|
|
|
|
|
|
|
|
|
|
|
Divide |
|
|
Overlay Mode
This controls how the layers are overlayed with respect to alpha coverage/transparency. The supported Porter-Duff layering options are as follows:
- Src
- Atop
- Over
- In
- Out
- Dest
- DestAtop
- DestOver
- DestIn
- DestOut
- Clear
- Xor
While any Overlay Mode can be combined with any color Blend Mode, the standard results will be achieved when using the 'Normal' Blend Mode.
Overlay Mode in Detail
In the following examples there are only two texture layers in use, the base layer is the Redshift logo and Layer 1 is the black Redshift text. Both textures have their out alpha connected to their respective layers alpha slot. The only thing that changes between each example is the Layer 1 Overlay Mode.
|
|
Base | Layer 1 |
This example's shader graph.
|
|
|
|
|
Src | Atop | Over | In | Out |
|
|
|
|
|
|
|
|
|
|
Dest | DestAtop | DestOver | DestIn | DestOut |
|
|
|
|
|
|
|
Clear | Xor |
Color Has Premultiplied Alpha
This option informs the shader whether or not the layer color texture has alpha pre-multiplied into it, which is often the case with 8-bit textures.
It is crucial that this option is set correctly for correct overlay blending to occur. Not doing this can yield unexpected results.