Graphics Reference
In-Depth Information
Figure 8.8. The final results of performing the rendering of a static mesh. Model courtesy of Radioactive
Software, LLC, www.radioactive-software.com . Created by Tomas Drinovsky, Danny Green.
the vertices consumed by the rasterizer, except that the position information is no longer needed
and hence doesn't appear in the output format of the rasterizer.
The pixel shader receives these fragments from the rasterizer and must determine the
color of the model at each fragment. The pixel shader is shown in Listing 8.2. We want the
pixel shader to sample a texture map to determine the surface properties of the mesh. As
described in Chapter 2, the Texture2D resource requires a shader resource view to bind
it to the pixel shader stage for read-only access. The pixel shader samples the texture and
then calculates the amount of illumination that is available at this point on the surface with
the dot product of the normal and light vectors. Finally, the surface color is modulated by
the illumination value, and the result is emitted as output color information to the output
merger stage. Finally, the output merger writes the output color data to the attached render
Search WWH ::




Custom Search