Graphics Reference
In-Depth Information
8
Fragment Shaders and
Surface Appearance
Just as with vertex shaders, there are specific roles for fragment processing in
the fixed-function graphics pipeline. Their task is to take state variables, plus
the values that are interpolated across a polygon, and produce a final color for
each pixel. In the fixed-function world there are few things to interpolate: posi-
tion, depth, color, and texture coordinates. The classical graphics literature
contains many more things that can be done with interpolations, however,
and the fragment shader in GLSL can do a great number of them. This chapter
describes the basics of fragment shaders, including some fun techniques you
can't do with fixed-function OpenGL graphics.
Once again, we consider the role of fragment processing in the graphics
pipeline, just as we did for the role of the vertex shader. The general place of
this functionality is shown in Figure 8.1, which recalls Figure 7.1. We see that
fragment processing takes the interpolated values within a graphics primitive
in screen space and produces pixels with color and depth to be incorporated
into the framebuffer.
157
 
 
Search WWH ::




Custom Search