142
edits
DavidJCobb (talk | contribs) m (→Blend modes: removing redundant table caption) |
DavidJCobb (talk | contribs) |
||
Line 23: | Line 23: | ||
* The '''blend operation''' is a simple math operation (e.g. addition, subtraction) that is applied to the source and destination colors ''after'' we've multiplied them by something. This operation combines the two colors into a final result, which is used as the color of the pixel that the player sees on-screen. | * The '''blend operation''' is a simple math operation (e.g. addition, subtraction) that is applied to the source and destination colors ''after'' we've multiplied them by something. This operation combines the two colors into a final result, which is used as the color of the pixel that the player sees on-screen. | ||
Colors are commonly represented as a set of three integers in the range [0, 255] — red, green, and blue — but for the math performed here, they're each treated as decimal values in the range [0, 1]. | Colors are commonly represented as a set of three integers in the range [0, 255] — the red, green, and blue channels — but for the math performed here, they're each treated as decimal values in the range [0, 1]. | ||
Let's look at a typical color-blending equation for painting a semi-transparent source color onto an opaque destination color: <math>C_o = \color{red}\alpha_s\color{black} C_s \color{green}+\color{black} \color{blue}(1-\alpha_s)\color{black}C_d</math>. Here, <math>C_o</math> is the output color — the final result of the whole process — while <math>C_s</math> and <math>C_d</math> are the source and destination colors, and <math>\alpha_s</math> is the source alpha. The parts of this equation that EffectShaders control have been marked with color: the Source Blend Mode is red, the Destination Blend Mode is blue, and the Blend Operation is green. | Let's look at a typical color-blending equation for painting a semi-transparent source color onto an opaque destination color: <math>C_o = \color{red}\alpha_s\color{black} C_s \color{green}+\color{black} \color{blue}(1-\alpha_s)\color{black}C_d</math>. The equation gets applied three times: once for red, once for green, and once for blue. Here, <math>C_o</math> is the output color — the final result of the whole process — while <math>C_s</math> and <math>C_d</math> are the source and destination colors, and <math>\alpha_s</math> is the source alpha. The parts of this equation that EffectShaders control have been marked with color: the Source Blend Mode is red, the Destination Blend Mode is blue, and the Blend Operation is green. | ||
* The Source Blend Mode is "Source Alpha:" we're multiplying the source alpha by the source color: <math>\alpha_s C_s</math>. | * The Source Blend Mode is "Source Alpha:" we're multiplying the source alpha by the source color: <math>\alpha_s C_s</math>. |
edits