Blending | This node modifies the blending rules for superposed pixels with industry standard presets | |
Alpha Blending | This node modifies the blending rules for superposed pixels. |
Alpha Blending is a technique used to specify how a pixel being drawn by a triangle and the pre-existing color value in the render output are mixed. It is commonly used to simulate transparency effects, see Introduction to Realtime Rendering.
When a fragment has passed all tests (see 3D Mask Nodes , Z-Testing Node, Alpha Testing Node, Stencil Nodes), its color is applied to the render output and overwrites any value previous set by other objects. With alpha blending, the final pixel color can be a combination of both the fragment (source) pixel color and alpha as well as the pixel color and alpha in the render output (destination).
The Blending Node offers Presets for common used blend functions. Only a subset of the available Blending Modes on the Layer level is available inside a 3D Layer.
Preset | Color Function | Alpha Function |
Overwrite | SourceColor | SourceAlpha |
Normal | SourceColor + DestinationColor * (1-SourceAlpha) | SourceAlpha + DestinationAlpha * (1-SourceAlpha) |
LinearDodge (Add) | SourceColor + DestinationColor | SourceAlpha + DestinationAlpha * (1-SourceAlpha) |
Screen | (SourceColor + DestinationColor) - (SourceColor * DestinationColor) | SourceAlpha + DestinationAlpha * (1-SourceAlpha) |
Substract Rendering from Background | SourceColor - DestinationColor | SourceAlpha + DestinationAlpha * (1-SourceAlpha) |
Substract Background from Rendering | DestinationColor - SourceColor | SourceAlpha + DestinationAlpha * (1-SourceAlpha) |
Multiply | SourceColor * DestinationColor | SourceAlpha + DestinationAlpha * (1-SourceAlpha) |
Multiply X2 | SourceColor * DestinationColor * 2 | SourceAlpha + DestinationAlpha * (1-SourceAlpha) |
Glow | SourceColor + DestinationColor | DestinationAlpha |
The shaders in Ventuz5 make sure the source color is pre-multiplied with the source alpha. This is why the formula for normal blending does not multiply the SourceColor with SourceAlpha, this has already happened in the shader. The same is true for all other blending modes.
Compared to the Blending Node there are no predefined blending modes here. Instead the Node directly offers the capability of the graphics card for greater flexibility. Both the source and destination color are treated as a 4-dimensional vector (red, green, blue, alpha) which is multiplied with a blend factor before applying the chosen operation.
color = (SourceColor * source_factor) op (DestinationColor * destination_factor)
The blend factors are selected with the Source and Destination properties:
The resulting vectors are combined with the Operation:
When using Maximum or Minimum as an operator, blend factors are ignored.
When SeparateAlpha is activated, a set of blend factors and operation can be used for the alpha channel that differs from the color channel. If SeparateAlpha is disabled RGB and A are using the same BlendFunction.
To recreate the presets from the Blending Node, enable SeparateAlpha and use these settings:
Preset | Color Function | Alpha Function |
Overwrite | (SourceColor * One) ADD (DestinationColor * Zero) | (SourceAlpha * One) ADD (DestinationAlpha * Zero) |
Normal | (SourceColor * One) ADD (DestinationColor * InverseSourceAlpha) | (SourceAlpha * One) ADD (DestinationAlpha * InverseSourceAlpha) |
LinearDodge (Add) | (SourceColor * One) ADD (DestinationColor * One) | (SourceAlpha * One) ADD (DestinationAlpha * InverseSourceAlpha) |
Screen | (SourceColor * InverseDestinationColor) ADD (DestinationColor * One) | (SourceAlpha * One) ADD (DestinationAlpha * InverseSourceAlpha) |
Substract Rendering from Background | (SourceColor * One) ReverseSubtract (DestinationColor * One) | (SourceAlpha * One) ADD (DestinationAlpha * InverseSourceAlpha) |
Substract Background from Rendering | (SourceColor * One) Subtract (DestinationColor * One) | (SourceAlpha * One) ADD (DestinationAlpha * InverseSourceAlpha) |
Multiply | (SourceColor * DestinationColor) ADD (DestinationColor * Zero) | (SourceAlpha * One) ADD (DestinationAlpha * InverseSourceAlpha) |
Multiply X2 | (SourceColor * DestinationColor) ADD (DestinationColor * SourceColor) | (SourceAlpha * One) ADD (DestinationAlpha * InverseSourceAlpha) |
Glow | (SourceColor * Onw) ADD (DestinationColor * One) | (SourceAlpha * Zero) ADD (DestinationAlpha * One) |