Texture Stage Arguments
Each of the multitexture blending operations combines two inputs. These can be selected by calling the IDirect3Ddevice8::SetTextureStageState method (described in the Direct3D SDK documentation) and specifying one of the following members of the D3DTEXTURESTAGESTATETYPE enumerated type.
Enumerator | Description |
---|---|
D3DTSS_ALPHAARG1 | Controls first input to alpha operation. |
D3DTSS_ALPHAARG2 | Controls second input to alpha operation. |
D3DTSS_COLORARG1 | Controls first input to color operation. |
D3DTSS_COLORARG2 | Controls second input to color operation. |
Texture Argument Flags
At each texture stage, any of the preceding four parameters can be set using the following texture argument flags.
Flag | Description |
---|---|
D3DTA_CURRENT | The texture argument is the result of the previous blending stage. In the first texture stage (stage zero), this argument is equivalent to D3DTA_DIFFUSE. This can be thought of as the current color of the polygon as each texture is composited onto it. If s represents the current texture stage, and s - 1 contains a bump-map texture, this argument becomes the result output by texture stage s - 2. |
D3DTA_DIFFUSE | The iterated color data obtained from the Gouraud interpolators. This is often used as the ARG2 on the first texture, because there is no D3DTA_CURRENT texture color at that point. |
D3DTA_TEXTURE | The texture bound to this texture stage using the IDirect3DDevice8::SetTexture (n, lpTex3) method (described in the Direct3D SDK documentation), where n is the stage number. IDirect3DDevice8::SetTexture defines which texture object to use for the texture in this stage when D3DTA_TEXTURE is one of the arguments. D3DTA_TEXTURE can only be present in D3DTSS_ALPHAARG1 and D3DTSS_COLORARG1, but not in D3DTSS_ALPHAARG1 and D3DTSS_COLORARG2. |
D3DTA_TFACTOR | A value set in Direct3D with D3DRENDERSTATE_TEXTUREFACTOR.
Note Some implementations may not be able to simultaneously use both D3DTA_TFACTOR and a D3DTA_DIFFUSE color. |
Modifier Flags
These two values should be combined with one of the preceding flags using the bit-wise OR operator.
Value | Description |
---|---|
D3DTA_ALPHAREPLICATE | Indicates that this argument should have its alpha channel replicated to all color channels before use in this operation. If this is a texture with only one component, it is automatically replicated to all color channels for these operations. This flag need not be specified for the ALPHA_ARGs, but using it does not produce an error. |
D3DTA_COMPLEMENT | Indicates that this argument should be inverted for the operation. |
Defaults
The following default values are used if a state is not filled in by the application. While these default values have been defined to make multitexture operations more convenient, robust code always fully specifies the desired state.
D3DTSS_COLORARG1 and D3DTSS_ALPHAARG1 both default to D3DTA_TEXTURE, if the corresponding texture has been set. If no texture has been set for this stage, then these both default to D3DTA_DIFFUSE.
D3DTSS_COLORARG2 and D3DTSS_ALPHAARG2 default to D3DTA_CURRENT. Note that D3DTA_CURRENT defaults to D3DTA_DIFFUSE on the first stage (except as noted in the description of D3DTA_CURRENT).
ARG2 defaults to D3DTA_DIFFUSE, but is ignored because the operation defaults to D3DTOP_SELECTARG1.
D3DTA_DIFFUSE defaults to 0xFFFFFFF if no diffuse color is specified in the flexible vertex format (FVF) data.
D3DTA_SPECULAR defaults to 0x00000000 if no specular color is specified in the FVF data.
D3DTA_CURRENT defaults to D3DTA_DIFFUSE if this is the first stage except when the previous blending stage is a D3DTOP_BUMPENVMAP or D3DTOP_BUMPENVMAPLUMINANCE color operation. In this case, the following occurs:
- If the previous stage is D3DTOP_BUMPENVMAP or D3DTOP_BUMPENVMAPLUMINANCE, then this argument is the result of the stage before the previous stage.
- In the second texture stage (stage one), this argument defaults to D3DTA_DIFFUSE.
D3DTA_TEXTURE is a value for a D3DTSS_COLORARG1 or D3DTSS_ALPHAARG1 state of any stage, or defaults to 0x0 if no texture is bound to this stage.
See Also
Direct3D Texture Management | Multitexturing
Last updated on Tuesday, May 18, 2004
© 1992-2003 Microsoft Corporation. All rights reserved.