Game Development Reference
In-Depth Information
'
If you are working in Photoshop, you
ll want to save the PSD file for future editing,
but our next step can ' t read PSDs. While you can use the DirectX Texture tool to
save your texture in DirectX
s DDS format, DirectX can load BMP, DIB, HDR, JPG,
PFM, PNG, PPM, and TGA files, too. Choosing which of these formats to use has
something to do with what tools are generating the textures, but also how you want
them compressed. There
'
'
s a good discussion of that in Chapter 8,
Loading and
Caching Game Data.
In Direct3D 11, a texture is loaded from a file or, as you
'
ll see below, from our
resource cache. Once in memory, it is stored in an ID3D11ShaderResourceView
structure, which is sent to a pixel shader. The pixel shader also needs information
about how the texture is to be sampled
or put another way, if the pixel shader
knows exactly where in the texture to sample, the sampling method will determine
what color will be returned by that sample.
Subsampling
If you
ll probably
recall an odd effect that happens to textured objects as you back away from them.
This effect, called scintillation, is especially noticeable on textures with a regular pat-
tern, such as a black-and-white checkerboard pattern. As the textured objects recede
in the distance, you begin to notice that the texture seems to jump around in weird
patterns. This is due to an effect called subsampling.
Assume for the moment that a texture appears on a polygon very close to its original
size. If the texture is 128 × 128 pixels, the polygon on the screen will look almost
exactly like the texture. If this polygon were reduced to half of this size, 64 × 64 pix-
els, the renderer must choose which pixels from the original texture must be applied
to the polygon. So what happens if the original texture looks like the one shown in
Figure 14.17?
'
ve ever seen old 3D games or perhaps just really bad 3D games, you
'
Figure 14.17
A texture particularly sensitive to subsampling.
 
 
Search WWH ::




Custom Search