Graphics Reference
In-Depth Information
Exercises
1. Duplicate the work shown in Figure 9.5 above for Mandelbrot sets to cre-
ate a texture via a Julia set computation.
2. Fixed-function OpenGL has its own texture environment functions, but
when you write your own shaders for textures you implement what you
need. In the chapter, we mentioned the four standard texture modes.
Ignoring for now the effect on the alpha channel, implement these modes:
a. For replace or decal mode, the color of a pixel is replaced by the color
of the texel.
b. For modulate mode, the color of a pixel is replaced by the product of the
color of the object pixel and the color of the texel.
c. For blend mode, the color of a pixel is replaced by the product of the
color of the object pixel and 1 - the color of the texel.
3. Continuing with texture modes, which of these modes would prob-
ably be the most useful if you were applying more than one texture to
an object? Why? Might this be different if you were including the alpha
channel in your textures?
4. Develop vertex and fragment shaders for a bump map that simulates
small partial spheres placed regularly on a surface, much like the pyra-
mid shader simulates pyramids.
5. One of the problems in cube mapping is creating a good set of textures
for the faces of the cube. You can do this from digital photographs if you
are careful to match the edges of the faces. Do this for some familiar envi-
ronment, such as your room or a campus quad.
6. Create a combined bump-map / cube-map image as shown in Fig-
ure 9.11.
7. Add other image processing effects to the multipass rendering example.
8. Find an excuse to change the two-pass example above to a three (or more)
pass example.
Search WWH ::




Custom Search