Graphics Reference
In-Depth Information
The geometry operations in
the fixed-function pipeline can be
replaced and possibly expanded by
any (or all) of the GLSL vertex shad-
ers, tessellation shaders, or geom-
etry shaders. A vertex shader only
operates on one vertex at a time and
can take the initial vertex definition
and alter it by changing the values
of the position, normal, or texture
coordinates. As we will see, the ver-
tex shader must set the transformed
position of each vertex. It may also
set the color for the vertex, espe-
cially if per-vertex lighting is used.
The tessellation shaders take
a set of points called a patch , which
can represent anything, and inter-
polate the points to create a new
geometry. You get to define what
meaning these points have. The
tessellation shaders will then assist
you in creating new geometry from
them.
A geometry shader can take a graphics primitive from a vertex shader
and create one or more new primitives. Geometry shaders can do the same
computation as a vertex shader to compute the full geometry and color of each
new vertex. They can also prepare variables for later use by a fragment shader.
The final shader capability is fragment processing, done by the fragment
shader. This takes the information developed by vertex processing (vertex
shader, tessellation shader, or geometry shader) and expands the traditional
fragment operations by leting you operate on each fragment individually to
generate the color of its pixel. This is a highly parallel operation that can apply
traditional or procedural textures; special coloring, such as pseudocolor trans-
fer functions; and advanced kinds of shading, such as Phong or anisotropic
shading. The operation can also determine whether its pixel is to be retained
or discarded for the final image. The fragment shader has the strongest impact
on the visual effect of your images.
In the next few sections, we will look at the functionality of each shader
by looking at simple examples. For reference, a sphere with only standard
Figure 3.2. The shader's-eye view of the pipeline.
Search WWH ::




Custom Search