Texture Stages and the Texture Blending Cascade

Direct3D supports single-pass multiple texture blending through the use of "texture stages." A texture stage takes two arguments and performs a blending operation on them, passing the result on for further processing or for rasterization. You could visualize a texture stage as shown in the following figure.

As the preceding illustration shows, texture stages blend two arguments by using a specified operator. Common operations include simple modulation or addition of the color or alpha components of the arguments, but more than two dozen operations are currently supported. The arguments for a stage can be an associated texture, the iterated color or alpha (iterated during Gouraud shading), arbitrary color and alpha, or the result from the previous texture stage. For more information, see Texture Blending Operations and Arguments.

The combination of arguments and operations used by multiple blending stages define a simple flow-based blending language. The results from one stage flow down to another stage, and then from that stage to the next, and so on. The idea that results flow from stage to stage to eventually be rasterized on a polygon is often called the "texture blending cascade." The following illustration shows how individual texture stages make up the texture blending cascade.

Each stage in a device has a zero-based index. Direct3D for DirectX 6.0 allows up to eight blending stages, although you should always check device capabilities to determine how many stages the current hardware supports. The first blending stage is at index 0, the second is at 1, and so on up to index 7. The system blends stages in increasing order of index.

Use only the number of stages you need; the unused blending stages are disabled by default. So, if your application only uses the first two stages, it need only set operations and arguments for stage 0 and 1, leaving the remaining stages alone. The system blends the two stages, and ignores the disabled stages.

Optimization Note  If your application varies the number of stages it uses for different situations—such as four stages for some objects, and only two for others—you don't need to explicitly disable all previously used stages. If you disable the color operation for the first unused stage, all stages with a higher index will not be applied. You can disable texture mapping altogether by setting the color operation for the first texture stage (stage 0).