142
edits
DavidJCobb (talk | contribs) |
DavidJCobb (talk | contribs) (→On blending: new section) |
||
Line 188: | Line 188: | ||
* If the shader is removed while still in ''Full Alpha Time'', then based on the subroutine above, it would wait for that time to expire, and only begin animating out as normal after ''Full Alpha Time'' is up. | * If the shader is removed while still in ''Full Alpha Time'', then based on the subroutine above, it would wait for that time to expire, and only begin animating out as normal after ''Full Alpha Time'' is up. | ||
== On blending == | |||
I believe the descriptions of the blend modes are wrong, and should be: | |||
* '''Source Alpha:''' The pixel currently being blended, times the source alpha. | |||
* '''Source Inverted Alpha:''' The pixel currently being blended, times (1 - the source alpha). | |||
* '''Destination Alpha:''' The pixel currently being blended, times the destination alpha. | |||
* '''Destination Inverted Alpha:''' The pixel currently being blended, times (1 - the destination alpha). | |||
The article suggests the following as equal to a typical alpha blend: | |||
* '''Source Blend Mode:''' Source Alpha | |||
* '''Dest Blend Mode:''' Source Inverted Alpha | |||
* '''Blend Operation:''' Add | |||
The equation for a typical alpha blend, assuming a fully-opaque destination, is <math>\alpha A + (1-\alpha)B</math>, where <math>\alpha</math> is the source alpha, <math>A</math> is the source ("over") color, and <math>B</math> is the destination ("under") color. If Source Inverted Alpha was always the source color times <math>1 - \alpha</math>, then we'd just be blending the source (EffectShader) color with itself (<math>\alpha A + (1-\alpha)A = (1-\alpha+\alpha)A = A</math>); but if instead it's ''the color being blended'' times <math>1 - \alpha</math>, then when it's used for the Destination Blend Mode, it'd produce <math>(1-\alpha)B</math>, which would indeed match the equation for alpha blending of a fully-opaque destination pixel. | |||
(I'm not sure if it's possible to handle blending of a semitranslucent shader onto a semitranslucent destination; but then, membrane EffectShaders are known not to work on alpha-blended (as opposed to alpha-tested) meshes anyway.) | |||
I'm updating the article accordingly. [[User:DavidJCobb|DavidJCobb]] ([[User talk:DavidJCobb|talk]]) 21:36, 20 August 2024 (EDT) |
edits