Graphics Reference
In-Depth Information
Exercises
1. Hand-code a polygon with different colors at each vertex and draw it,
specifying flat shading using only the fixed-function pipeline. Describe
the result, and discuss why this result may happen.
2. Hand-code a polygon having more than three vertices with different col-
ors at each vertex and draw it, specifying smooth shading using only the
fixed-function pipeline. Describe the result, and discuss why this result
may happen. It may help to try several examples where the vertex order
or the color at each vertex is changed.
3. Create a simple surface of your choosing and color it, based on the
model-space elevation of each pixel. You may either color the whole sur-
face based on elevation, or you may use a lighting model to display the
surface and create contour lines based on elevation.
4. Write the necessary shaders to create a Phong-shaded version of the
ripple surface of Figure 8.7, and compare it to the exact-shaded surface
shown there. Can you see a difference? What if you zoom in very closely
to the surface?
5. Take the fragment shader for round bumps on a sphere and adapt it from
a purely diffuse lighting and shading model to a Phong lighting and
shading model.
6. Identify another analytic surface besides that of Figure 8.7; you may find
examples from mathematics, physics, chemistry, or other sources. Create
the surface and calculate exact shading for it as described in this chapter.
Compare that with smooth or Phong shading for the surface.
7. Add the ChromaDepth( ) function to any program you have writen, such
as the surface of the previous exercise, in order to use the ChromaDepth
coloring to present a three-dimensional image to the viewer.
Search WWH ::




Custom Search