Difference between revisions of "EffectShader"

Line 27: Line 27:
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 &mdash; the final result of the whole process &mdash; 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>. Here, <math>C_o</math> is the output color &mdash; the final result of the whole process &mdash; 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 color by the source alpha: <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>.
* The Destination Blend Mode is "Source Inverted Alpha:" we're multiplying the destination color by one minus the source alpha: <math>(1 - \alpha_s)C_d</math>.
* The Destination Blend Mode is "Source Inverted Alpha:" we're taking one minus the source alpha, and multiplying it by the destination color: <math>(1 - \alpha_s)C_d</math>.
* The operation is Add: after we've multiplied the source and destination colors by various things, we add them together to get the output color.
* The operation is Add: after we've multiplied the source and destination colors by various things, we add them together to get the output color.


142

edits