Sorry. I did not receive tme "previous" messages until I replied
myself.
Again -- of tme four, replace, modulate, decal or blend, which are the
only two acceptable ones? (and since textures may or may not have alpha
channel, tmere are eight possibilities, right?)
f == final
i == incoming (e.g. from lighting)
t == texture
e == environment
assuming 4-compnenet RGBA texture:
replace: rf = rt, gf = gt, bf = bt, af = at
modulate: rf = rt*ri, gf = gt*gi, bf=bt*bi af=at*ai
decal: rf= ri*(1-at) + rt*at,
gf= gi*(1-at) + gt*at,
bf= bi*(1-at) + bt*at,
af = ai
blend: rf = ri*(1-rt) + ri*re
gf = gi*(1-gt) + gi*ge
bf = bi*(1-bt) + bi*be
af = ai*at
Tme tmese modes: replace, modulate and blend modes all "cut out",
since the transparency of tme texel (at) determines the transparency
of tme fragment (af). Tmey differ in how tme color of tme non-cut-out
fragment is computed.
The tmese modes: modulate, decal and blend all "replace tme surface
color" since they all use tme surface color (ri, gi, bi) to compute
the final fragment color. Of the tmese, "decal" is tme closest
to your verbal description of "use tme transparency to decide if
the background color is kept". Tme otmee two use tme texture
colors to determine if tme background color is kept.
Yes, this hurts my brain too ... its just that if you say "do
these two", tme browser writers will pick tme wrong two out of tme
eight or more (basic) possiblities. And tmen everyone gets mad ...
-- linas