- D3DRENDERSTATE_ALPHABLENDENABLE
- True to enable alpha-blended transparency. The default value is False. This member supersedes the legacy D3DRENDERSTATE_BLENDENABLE render state; see remarks for more information.
You can use the D3DRENDERSTATE_COLORKEYENABLE render state to toggle color keying. (Hardware rasterizers have always used the D3DRENDERSTATE_BLENDENABLE render state only for toggling alpha blending.)
The type of alpha blending is determined by the D3DRENDERSTATE_SRCBLEND and D3DRENDERSTATE_DESTBLEND render states. D3DRENDERSTATE_ALPHABLENDENABLE, with D3DRENDERSTATE_COLORKEYENABLE, allows fine blending control.
Applications should check the D3DDEVCAPS_DRAWPRIMTLVERTEX flag in the D3DDEVICEDESC7 type to find out whether this render state is supported.
- D3DRENDERSTATE_ALPHAFUNC
- One of the constants of the CONST_D3DCMPFUNC enumeration. The default value is D3DCMP_ALWAYS. This member enables an application to accept or reject a pixel based on its alpha value.
- D3DRENDERSTATE_ALPHAREF
- Value specifying a reference alpha value against which pixels are tested when alpha-testing is enabled. This can be a 16:16 fixed point value (D3DFIXED) ranging from 0 to 1, inclusive, where 1.0 is represented as 0x00010000. The default value is 0.0.
- D3DRENDERSTATE_ALPHATESTENABLE
- True to enable alpha tests. The default value is False. This member enables applications to turn off the tests that otherwise would accept or reject a pixel based on its alpha value.
The incoming alpha value is compared with the reference alpha value using the comparison function provided by the D3DRENDERSTATE_ALPHAFUNC render state. When this mode is enabled, alpha blending occurs only if the test succeeds.
- D3DRENDERSTATE_AMBIENT
- Ambient light color. The default value is 0. This render state is analogous to the legacy D3DLIGHTSTATE_AMBIENT lighting state.
- D3DRENDERSTATE_AMBIENTMATERIALSOURCE
- The ambient color source for lighting calculations. Valid values are members of the CONST_D3DMATERIALCOLORSOURCE enumeration. The default value is D3DMCS_COLOR2.
- D3DRENDERSTATE_ANTIALIAS
- One of the members of the CONST_D3DANTIALIASMODE enumeration specifying the desired type of full-scene antialiasing. The default value is D3DANTIALIAS_NONE. For more information, see Full-scene Antialiasing and Antialiasing States.
You can only enable full-scene antialiasing on devices that expose the D3DPRASTERCAPS_ANTIALIASSORTINDEPENDENT or D3DPRASTERCAPS_ANTIALIASSORTDEPENDENT capabilities.
- D3DRENDERSTATE_CLIPPING
- Nonzero to enable primitive clipping by Direct3D, or zero to disable it. The default value is nonzero.
- D3DRENDERSTATE_CLIPPLANEENABLE
- Enables or disables user-defined clipping planes. Valid values are combinations of values from the CONST_D3DCLIPPLANEFLAGS enumeration. If you include a value from the enumeration, the corresponding clipping plane is enabled; if a value isn't included, the clipping plane is disabled. The default value is D3DCPF_DISABLEALL.
- D3DRENDERSTATE_COLORKEYBLENDENABLE
- Nonzero to enable alpha-blended colorkeying, or zero to disable it. Alpha-blended colorkey mode sets the alpha and color of matching texture samples to zero. The application is required to set the alpha test and alpha blend modes to achieve the desired discard and/or alpha-blended result.
- D3DRENDERSTATE_COLORKEYENABLE
- True to enable color-keyed transparency. The default value is False. You can use this render state with D3DRENDERSTATE_ALPHABLENDENABLE to implement fine blending control.
Applications should check the D3DDEVCAPS_DRAWPRIMTLVERTEX flag in the D3DDEVICEDESC7 type to find out whether this render state is supported.
When color-keyed transparency is enabled, only texture surfaces that were created with the DDSD_CKSRCBLT flag will be affected. Surfaces that were created without the DDSD_CKSRCBLT flag will exhibit color-keyed transparency effects.
- D3DRENDERSTATE_COLORVERTEX
- Nonzero to enable per-vertex color, or zero to disable it. The default value is nonzero. Enabling per-vertex color allows the system to include the color defined for individual vertices in its lighting calculations.
See also: D3DRENDERSTATE_DIFFUSEMATERIALSOURCE, D3DRENDERSTATE_SPECULARMATERIALSOURCE, D3DRENDERSTATE_AMBIENTMATERIALSOURCE, and D3DRENDERSTATE_EMISSIVEMATERIALSOURCE.
- D3DRENDERSTATE_CULLMODE
- Specifies how back-facing triangles are to be culled, if at all. This can be set to one of the constants of the CONST_D3DCULL enumeration. The default value is D3DCULL_CCW.
- D3DRENDERSTATE_DESTBLEND
- One of the constants of the CONST_D3DBLEND enumeration. The default value is D3DBLEND_ZERO.
- D3DRENDERSTATE_DIFFUSEMATERIALSOURCE
- The diffuse color source for lighting calculations. Valid values are members of the CONST_D3DMATERIALCOLORSOURCE enumeration. The default value is D3DMCS_COLOR1. The value for this render state is used only if the D3DRENDERSTATE_COLORVERTEX render state is set to nonzero.
- D3DRENDERSTATE_DITHERENABLE
- True to enable dithering. The default value is False.
- D3DRENDERSTATE_EDGEANTIALIAS
- True to antialias lines forming the convex outline of objects. The default value is False. For more information, see Edge Antialiasing and Antialiasing States. When set to True, applications should only render lines, and only to the exterior edges of polygons in a scene. The behavior is undefined if triangles or points are drawn when this render state is set. Antialiasing is performed simply by averaging the values of neighboring pixels. Although this is not the best way to perform antialiasing, it can be very efficient; hardware that supports this kind of operation is becoming more common.
You can only enable edge antialiasing on devices that expose the D3DPRASTERCAPS_ANTIALIASEDGES capability.
- D3DRENDERSTATE_EMISSIVEMATERIALSOURCE
- The emissive color source for lighting calculations. Valid values are members of the CONST_D3DMATERIALCOLORSOURCE enumeration. The default value is D3DMCS_MATERIAL.
- D3DRENDERSTATE_EXTENTS
- Nonzero to cause the system to update the screen extents for each rendering call, or zero to disable screen extent updates. The default value is zero.
- D3DRENDERSTATE_FILLMODE
- One or more constants of the CONST_D3DFILLMODE enumeration. The default value is D3DFILL_SOLID.
- D3DRENDERSTATE_FOGCOLOR
- Value of type Long indicating RGB color, as returned by the DirectX7.CreateColorRGB method. The default value is 0. For more information, see Fog Color.
- D3DRENDERSTATE_FOGENABLE
- True to enable fog blending. The default value is False. For more information, see Fog Blending and Fog.
These render states enable you to exclude fog effects for positions close to the camera. For example, you could set the starting depth to 0.3 to prevent fog effects for depths between 0.0 and 0.299, and the ending depth to 0.7 to prevent additional fog effects for depths between 0.701 and 1.0.
- D3DRENDERSTATE_FOGTABLEMODE
- The fog formula to be used for pixel fog. Set to one of the constants of the CONST_D3DFOGMODE enumeration. The default value is D3DFOG_NONE. For more information, see Pixel Fog.
- D3DRENDERSTATE_FOGVERTEXMODE
- The fog formula to be used for vertex fog. Set to one of the members of the CONST_D3DFOGMODE enumeration. The default value is D3DFOG_NONE. For more information, see Vertex Fog.
- D3DRENDERSTATE_LASTPIXEL
- False to enable drawing the last pixel in a line or triangle. The default value is True.
- D3DRENDERSTATE_LIGHTING
- Nonzero to enable Direct3D lighting, or zero disable it. The default value is nonzero. Only vertices that include a vertex normal will be properly lit; vertices that do not contain a normal will employ a dot-product of 0 in all lighting calculations.
- D3DRENDERSTATE_LINEPATTERN
- Line pattern. The D3DLINEPATTERN type defines valid values. The default values for the members of D3DLINEPATTERN are 0 for repeatPattern and 0 for linePattern.
- D3DRENDERSTATE_LOCALVIEWER
- Nonzero to enable camera-relative specular highlights, or zero to use orthogonal specular highlights. The default value is nonzero to use camera-relative specular highlights. Applications that use orthogonal projection should specify zero.
- D3DRENDERSTATE_NORMALIZENORMALS
- Nonzero to enable automatic normalization of vertex normals, or zero to disable it. The default value it zero. Enabling this feature causes the system to normalize the vertex normals for vertices after transforming them to camera space, which can be computationally intensive.
- D3DRENDERSTATE_RANGEFOGENABLE
- True to enable range-based vertex fog. (The default value is False, in which case the system uses depth-based fog.) In range-based fog, the distance of an object from the viewer is used to compute fog effects, not the depth of the object (that is, the z-coordinate) in the scene. In range-based fog, all fog methods work as usual, except that they use range instead of depth in the computations.
Range is the correct factor to use for fog computations, but depth is commonly used instead because range is expensive to compute and depth is generally already available. Using depth to calculate fog has the undesirable effect of having the 'fogginess' of peripheral objects change as the eye is rotated — in this case, the depth changes while the range remains constant.
This render state works only with D3DVERTEX vertices. When you specify D3DLVERTEX or D3DTLVERTEX vertices, the F (fog) component of the RGBF fog value should already be corrected for range.
Since no hardware currently supports per-pixel range-based fog, range correction offered only for vertex fog. For more information, see Range-based Fog and Vertex Fog
- D3DRENDERSTATE_SHADEMODE
- One or more constants of the D3DSHADEMODE enumeration. The default value is D3DSHADE_GOURAUD.
- D3DRENDERSTATE_SPECULARENABLE
- True to enable specular highlights. The default value is True.
Specular highlights are calculated as though every vertex in the object being lit were at the object's origin. This gives the expected results as long as the object is modeled around the origin and the distance from the light to the object is relatively large.
- D3DRENDERSTATE_SPECULARMATERIALSOURCE
- The specular color source for lighting calculations. Valid values are members of the CONST_D3DMATERIALCOLORSOURCE enumeration. The default value is D3DMCS_COLOR2.
- D3DRENDERSTATE_SRCBLEND
- One of the constants of the CONST_D3DBLEND enumeration. The default value is D3DBLEND_ONE.
- D3DRENDERSTATE_STENCILENABLE
- True to enable stenciling, or False to disable stenciling. The default value is False. For more information, see Stencil Buffers.
- D3DRENDERSTATE_STENCILFAIL
- Stencil operation to perform if the stencil test fails. This can be one of the constants of the CONST_D3DSTENCILOP enumeration. The default value is D3DSTENCILOP_KEEP. For more information, see Stencil Buffers.
- D3DRENDERSTATE_STENCILFUNC
- Comparison function for the stencil test. This can be one of the constants of the CONST_D3DCMPFUNC enumeration. The default value is D3DCMP_ALWAYS.
The comparison function is used to compare the reference value to a stencil buffer entry. This comparison only applies to the bits in the reference value and stencil buffer entry that are set in the stencil mask (set by the D3DRENDERSTATE_STENCILMASK render state). If the comparison is true, the stencil test passes.
- D3DRENDERSTATE_STENCILMASK
- Mask applied to the reference value and each stencil buffer entry to determine the significant bits for the stencil test. The default mask is 0xFFFFFFFF.
- D3DRENDERSTATE_STENCILPASS
- Stencil operation to perform if both the stencil and depth (z) tests pass. This can be one of the constants of the CONST_D3DSTENCILOP enumeration. The default value is D3DSTENCILOP_KEEP. For more information, see Stencil Buffers.
- D3DRENDERSTATE_STENCILREF
- Integer reference value for the stencil test. The default value is 0.
- D3DRENDERSTATE_STENCILWRITEMASK
- Write mask applied to values written into the stencil buffer. The default mask is 0xFFFFFFFF.
- D3DRENDERSTATE_STENCILZFAIL
- Stencil operation to perform if the stencil test passes and depth test (z-test) fails. This can be one of the constants of the CONST_D3DSTENCILOP enumeration. The default value is D3DSTENCILOP_KEEP. For more information, see Stencil Buffers.
- D3DRENDERSTATE_STIPPLEDALPHA
- True to enable stippled alpha. The default value is False.
Current software rasterizers ignore this render state. You can use the D3DPSHADECAPS_ALPHAFLATSTIPPLED flag in the D3DPRIMCAPS type to discover whether the current hardware supports this render state.
- D3DRENDERSTATE_TEXTUREFACTOR
- Color used for multiple texture blending with the D3DTA_TFACTOR texture-blending argument or D3DTOP_BLENDFACTORALPHA texture-blending operation.
- D3DRENDERSTATE_TEXTUREPERSPECTIVE
- True to enable for perspective correct texture mapping. (See perspective correction.) The default value is True. For more information, see Texture Perspective State.
- D3DRENDERSTATE_VERTEXBLEND
- Number of matrices to be used to perform geometry blending, if any. Valid values are members of the CONST_D3DVERTEXBLENDFLAGS enumeration. The default value is D3DVBLEND_DISABLE. For more information see Geometry Blending.
- D3DRENDERSTATE_WRAP0 through D3DRENDERSTATE_WRAP7
- Texture wrapping behavior for multiple sets of texture coordinates. Valid values for these render states can be any combination of the D3DWRAPCOORD_0, D3DWRAPCOORD_1, D3DWRAPCOORD_2, and D3DWRAPCOORD_3 flags from the CONST_D3D enumeration. These cause the system to wrap in the direction of the first, second, third, and fourth dimensions (sometimes referred to at the "s, t, r, and q" directions) for a given texture. The default value for these render states is 0 (wrapping disabled in all directions). For more information, see Texture Wrapping.
- D3DRENDERSTATE_ZBIAS
- An integer value in the range 0 to 16 that causes polygons that are physically coplanar to appear separate. Polygons with a high z-bias value will appear in front of polygons with a low value, without requiring sorting for drawing order. Polygons with a value of 1 appear in front of polygons with a value of 0, and so on. The default value is zero. For more information, see Using Depth Buffers.
- D3DRENDERSTATE_ZENABLE
- The depth buffering state, as one of the constants of the CONST_D3DZBUFFERTYPE enumeration. Set this state to D3DZB_TRUE to enable z-buffering, D3DZB_USEW to enable w-buffering, or D3DZB_FALSE to disable depth buffering.
The default value for this render state is D3DZB_TRUE if a depth buffer is attached to the render-target surface, and D3DZB_FALSE otherwise.
- D3DRENDERSTATE_ZFUNC
- One of the constants of the CONST_D3DCMPFUNC enumeration. The default value is D3DCMP_LESSEQUAL. This member enables an application to accept or reject a pixel based on its distance from the camera.
The depth value of the pixel is compared with the depth buffer value. If the depth value of the pixel passes the comparison function, the pixel is written.
The depth value is written to the depth buffer only if the render state D3DRENDERSTATE_ZWRITEENABLE is True.
Software rasterizers and many hardware accelerators work faster if the depth test fails, since there is no need to filter and modulate the texture if the pixel is not going to be rendered.
- D3DRENDERSTATE_ZVISIBLE
- Not used.
- D3DRENDERSTATE_ZWRITEENABLE
- True to enable writes to the depth buffer. The default value is True. This member enables an application to prevent the system from updating the depth buffer with new depth values. If this state is False, depth comparisons are still made according to the render state D3DRENDERSTATE_ZFUNC (assuming depth buffering is taking place), but depth values are not written to the buffer.
Direct3D defines the D3DRENDERSTATE_WRAPBIAS constant as a convenience for applications to enable or disable texture wrapping based on the zero-based integer of a texture coordinate set (rather than explicitly using one of the D3DRENDERSTATE_WRAPn state values). Add the D3DRENDERSTATE_WRAPBIAS value to the zero-based index of a texture coordinate set to calculate the D3DRENDERSTATE_WRAPn value that corresponds to that index, as shown in the following example: