User's Manual

Intel® 815 Chipset: Graphics Controller PRM, Rev 1.0
R
233
13.15. GFXRENDERSTATE_COLOR_CHROMA_KEY
ColorKey and ChromaKey are terms used to describe two methods of removing a specific color or range
of colors from a map that is applied to a primitive.
When a color palette is used with indices to indicate a color in the palette, the indices can be compared
against a state variable “ColorKey Index Value” and if a match occurs and ColorKey is enabled, then an
action will be taken to remove this value’s contribution to the resulting pixel color.
The ChromaKey mode refers to testing the RGB components to see if they fall between a high
(Chroma_High_Value) and low (Chroma_Low_Value) state variable values. If the color of a texel
contribution is in this range and ChromaKey is enabled, then an action will be taken to remove this
contribution to the resulting pixel color.
When the color value of the nearest neighbor texel falls within the range of the ChromaKey values or the
palletized texel index matches the ColorKey value, the pixel can be programmed by the Kill Pixel state
variable to not be written back to the frame buffer. If neither “Key” mode applies, then a blend occurs as
described below.
When multiple texture is enabled, only the color of texel 0 is used for ChromaKey or ColorKey. The
color of texel 1 is not subject to texture color/chroma key. Filtering and use of texel 1 (if enabled)
proceeds normally irrespective of color/chroma key.
Kill Pixel Mode
This is the default function for texture color/chroma key in D3D*. (Prior to DX7*, it was the only
function). Pixels whose sampled texels are considered “matching” the color/chroma key are killed
(discarded) and not drawn (regardless of any subsequent pipeline operations). The Intel
®
810 chipset
implementation of the “matching” criteria is somewhat different than the D3D* reference rasterizer
behavior introduced in DX6.1. DX6.1 will kill the pixel if any “contributing” sampled texels match the
key. (Here “contributing” is defined as having an non-zero filter (beta) weight – as opposed to non-
contributing texels that may be sampled/fetched but effectively not used). This behavior tends to enlarge
keyed-out areas depending on the size of the filter. The Intel
®
810 chipset implementation only kills a
pixel if the nearest neighbor sampled texel matches the key. Non-nearest neighbor texels matching the
key are effectively replaced by the nearest neighbor’s color/alpha and then used in the filter. This
behavior avoids the enlargement of keyed-out areas.
The Intel
®
815 chipset supports both Kill Pixel modes. The default is the DX6.1 implementation.
“Blend” Mode
This mode was intended to support the “BLENDCOLORKEY” D3D* mode (which will be introduced
into D3D* in DX7*). Here color/chroma key does not discard pixels, it simply modifies the filtered texel
color/alpha in a way which permits keyed-out areas of textures from not contributing to the pixel output.
Here the application is responsible for programming the pixel pipeline (texture blend, alpha test, alpha
blend, etc.) to process keyed/non-keyed texel/pixel results in the intended fashion (i.e., there is no
automatic override of pixel pipeline controls). For example, the application may simply choose to use the
filtered texel’s alpha value in the Alpha Test stage to discard pixels with zero alpha (presumably
introduced by the color/chroma key function) – this would effectively emulate the kill pixel mode.
Another scenario might modulate the filtered texel’s color by the filtered texel’s alpha, and then add the
result to the current pixel.