Alpha Blending
| 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 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).
There are no predefined blending modes like "Overlay" or "Screen". Instead Ventuz 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 = (source_color * source_factor) op (destination_color * destination_factor)
The blend factors are selected with the Source and Destination properties:
- One: Multiply each component by one.
- Zero: All channels of the color are multiplied by zero
- BlendFactor: Multiply each component by the respective component of the color specified in the BlendFactor property.
- InverseBlendFactor: Multiply each component by the respective inverse component of the color specified in the BlendFactor property.
- BothInverseSourceAlpha: The source color is multiplied by one minus the source alpha and the destination color is multiplied by the source alpha
- SourceAlphaSaturated: The red, green and blue channel are multiplied with the min(alpha_source, 1 - alpha_destination), alpha is multiplied by one. This can only be used for Source and will override the value set in Destination.
- InverseDestinationColor: Multiply each component with one minus the respective component in the destination color.
- DestinationColor: Multiply each component with the respective component in the destination color.
- InverseDestinationAlpha: Multiply all channels with one minus the destination alpha.
- DestinationAlpha: Multiply all channels with the destination alpha.
- InverseSourceAlpha: Multiply all channels with one minus the source alpha.
- SourceAlpha: Multiply all channels with the source alpha.
- InverseSourceColor: Multiply each component with one minus the respective component in the source color.
- SourceColor: Multiply each component with the respective component in the source color.
The resulting vectors are combined with the Operation:
- Add: Result = Source + Destination
- Maximum: Result = MAX(Source, Destination)
- Minimum: Result = MIN(Source, Destination)
- ReverseSubstract: Result = Destination - Source
- Substract: Result = Source - Destination
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.