Alpha Operation |
When covering an object's surface with a texture the operation can be determined that will be executed between the texture and the object surface. The maximum number of operations and textures that can be set is 8. The active operation stage to be set is determined by the
stage element. It will assert itself for an
active object. The stage number permissible can be detected by reading the
stage element.
The
alpha operation element defines the operation to be performed with the
alfa component. Similarly the operation with the color can be defined by means of the
color operation element. The alpha operation can assume following values:
1 the operation stage and all following stages are switched off
4 modulation, output = arg1 * arg2
5 modulation 2x, output = arg1 * arg2 * 2
6 modulation 4x, output = arg1 * arg2 * 4
7 add, output = arg1 + arg2
8 add signed, output = arg1 + arg2 - 0.5
9 add signed 2x, output = (arg1 + arg2 - 0.5) * 2
10 subtract, output = arg1 - arg2
11 add smoothed, output = arg1+arg2 - arg1*arg2
12 blend, alpha from color, output = arg1*(alpha) + arg2*(1-alpha)
13 blend, alpha from texture, output = arg1*(alpha) + arg2*(1-alpha)
14 blend, alpha from
factor,
output = arg1*(alpha) + arg2*(1-alpha)
15 blend, premultiplied alpha from texture, output = arg1 + arg2*(1-alpha)
16 blend, alpha from result, output = arg1*(alpha) + arg2*(1-alpha)
17 premodulate, modulate with next texture stage
For stage 0 the modulation operation (code 4) is set as a default setting, the other stages being switched off (code 1).
Not all operations are supported by every interface and videocard. The OpenGL interface enables to carry out the argument choice and modulation operations (operations 1 through 4) only, the argument can be the object color or texture. The alpha channel operations are ignored. The DirectX 5 interface supports, besides operations quoted for the OpenGL, the addition (7) operation. Operations 5, 6, 8 and 9 are replaced by operations 4 and 7. A full support of operations exists only for the DirectX 6 through DirectX 8, depending on whether the operations are supported by the videocard. If the desired operation is not supported by the videocard, then a better option can be the use of a software driver that supports most of the operations.
Full Html Context Help of The Peter - Gemtree Software & Children Programming