Graphics Reference
In-Depth Information
The available types of filtering for each of these scenarios are point sampling, linear
sampling, and anisotropic sampling. Point sampling simply returns the texel that the input
texture coordinates happen to fall on. This is the least expensive form of sampling, but
it also produces the lowest image quality in most situations. Linear sampling provides a
higher quality of sampling, in which the texels that surround an input texture coordinate are
interpolated to find an approximated value somewhere between the selected texels. This
produces smoother transitions between texels, but it requires additional texels to be read, in
addition to performing some arithmetic on the sampled data before returning the result. The
final option is to utilize anisotropic sampling, a much higher-quality sampling technique.
When a texture is viewed at any angle that is not perpendicular to the camera's line of sight,
anisotropic filtering performs a number of samples to determine the average color that is
visible to the viewer and returns this combined color. The maximum number of samples is
specified in the MaxAnisotropy parameter of the sampler state description structure. While
this filtering mode produces the best results, it can be extremely expensive to use, due to
the much higher bandwidth and computation needed to produce the final sample value.
In the first half of the D3Dll_FILTER enumeration, we see all of the various combi-
nations of filtering types that can be used. In the second half of the enumeration, we see
a repeat of the list from the first half, except for the addition of COMPARISON in the value
names. This indicates that each of the individual samples used in the sampling process will
be used in the comparison function (which will be discussed shortly) prior to combining
the result. This allows the result of the comparisons to be filtered, instead of filtering the
texture first and then performing a comparison.
The next three options in the sampler description structure specify the texture ad-
dressing modes in the U, V, and W directions that correspond to the X, Y, and Z coordinates
of the texture. 3 These modes let you specify what action to take when a texture coordinate
that lies outside of the [0,1] range is used during sampling. A different addressing mode can
be specified for each direction. You can have the sampler wrap the texture coordinates back
around to 0 when they are greater than 1, effectively "wrapping" the texture over again. If
the texture coordinate is greater than 2, the texture would be wrapped again, and so on. This
allows many copies of a texture to appear on a textured surface. Another possible mode is
the mirror addressing mode, which essentially flips the texture at every integer coordinate.
This also allows many copies of the texture to be visible, but it flips the orientation for each
consecutive copy of the texture. You can also specify a clamp mode, in which the texture
coordinates are "clamped" to the [0,1] range. This effectively makes the boundary values
of the texture appear at any location outside of the texture. An alternative to this mode is
a border addressing mode, in which the sampler state can specify a replacement color to
return when the coordinates are outside of the [0,1] range. The border color is specified
in the BorderColor parameter of the sampler description object. Finally, you can use a
3 These coordinates are subject to the same dimensionality that was described for the texture coordinates. For
example, a 1D texture does not have a notion of a Y or Z coordinate, while a 3D texture has all three.
Search WWH ::




Custom Search