Graphics Reference
In-Depth Information
The Filter property of the sampler state description controls which texels will be used
and how they are combined to generate the final pixel. Here, we have used Filter.
MinMagMipLinear , which provides a better quality result than the default Filter.
MinMagMipPoint value. The sampler will now use linear interpolation when minifying,
when magnifying, and for mid-level sampling. Zooming in and out will show the effect of
the filtering method used. Try changing the triangle or quad back to the default and see
the contrast in quality. Also, try doing this with other filter values.
To make the SRV and sampler state available to the pixel shader, we have bound them with
a call to PixelShader.SetShaderResource and PixelShader.SetSampler within
DoRender of each renderer. We have specified slot 0 for both of these functions which
correlate to register(t0) and register(s0) within the shader for the texture and
sampler state respectively.
Next, we have defined our new vertex buffers. These buffers are now represented by an
array of six floats for each vertex. The axis lines are sampling single texels for each line that
approximates the original colors used (red/green/blue). The triangle is sampling within the
bounds of the texture (between zero and one) to select the entire width of the texture at the
base and the top-center of the texture at the apex. The quad is addressing twice the width and
height of the texture (between zero and two) that combined with the TextureAddressMode.
Wrap value that is repeating the texture four times within the surface.
To address z-fighting/flimmering, the triangle has been brought forward
by a tiny amount. To see the effects of these depth artifacts, try setting
the z coordinate value back to zero.
See also
F See Chapter 3 , Rendering Meshes , and Chapter 4 , Animating Meshes with Vertex
Skinning , for more examples of texture sampling and a discussion on UV unwrapping
F The recipe Loading and compiling resources asynchronously in Chapter 11 ,
Integrating Direct3D with XAML and Windows 8.1 , demonstrates how to load
images into an SRV for Windows Store apps
 
Search WWH ::




Custom Search