

This capability gives you control over which portion of a texture is mapped into a primitive. Your application can assign texture coordinates directly to vertices.

For more information, see Texture Filtering (Direct3D 9). You determine the method that Direct3D uses to arrive at the pixel color when you set the texture filtering method. The final color value of the pixel is computed from the texels in the region to which the pixel maps. The mapping process distorts the pixel's shape again, which is common. The corners of the surface area on the primitive that correspond the corners of the pixel are then mapped into texture space. The shape of the pixel is often distorted because of the shape of the primitive in 3D space and because of the viewing angle. The addresses of the four corners of the pixel are mapped into the 3D primitive in object space. For more detailed information, see Directly Mapping Texels to Pixels (Direct3D 9).įor this example, a pixel, shown at the left of the illustration, is idealized into a square of color. Admittedly, this example is extremely simple. The texture address (0.5,1.0) maps to texel (3,6).Ī simplified version of the texel mapping process is shown in the following illustration. The texture address (0.5,1.0) maps to texel (2,4). However, because the textures are different sizes, the texture address maps to different texels. In the following illustration, the texture address is (0.5,1.0). For more information, see Texture Addressing Modes (Direct3D 9).Ī result of this is that identical texture addresses can map to different texel coordinates in different textures. Technically, the system can actually process texture coordinates outside the range of 0.0 and 1.0, and does so by using the parameters you set for texture addressing. Direct3D applications specify texture coordinates in terms of u,v values, much like 2D Cartesian coordinates are specified in terms of x,y coordinates. Therefore, it uses a generic addressing scheme in which all texel addresses are in the range of 0.0 to 1.0 inclusive. However, in order to map texels onto primitives, Direct3D requires a uniform address range for all texels in all textures. For more information, see Texture Filtering (Direct3D 9).Įach texel in a texture can be specified by its texel coordinate. The sampling process is called texture filtering. The texture color at or around that point is sampled. That is, for each pixel in screen space, the corresponding texel position in texture space is calculated. This mapping process is actually an inverse mapping. Mapping Texels to Screen Spaceĭirect3D maps texels in texture space directly to pixels in screen space, skipping the intermediate step for greater efficiency. They must then be translated into screen coordinates, or pixel locations.


When a texture is applied to a primitive in 3D space, its texel addresses must be mapped into object coordinates. That is, they are relative to the location (0,0) in the texture. Texture coordinates are in texture space. The address can be thought of as a column and row number, which are labeled u and v respectively in the following illustration. Each texel has a unique address in the texture. The individual color values are called a texture element, or texel. For details, see Cubic Environment Mapping (Direct3D 9). Cubic environment map textures are an exception. Most textures, like bitmaps, are a two-dimensional array of color values.
