Graphics Reference
In-Depth Information
the six images in the cube map is determined from an eye position at the
center of the cube, thus forever “baking in” that direction's spatial relation-
ships from just a single eye position. This imperfection is true for both cube
map reflections and refractions. Also, when doing cube map refractions, the
refraction only takes place at the front surface of the object, not both front
and back, as would be the case with a real object. In 3D graphics, the back
surface's behavior gets z-buffered out.
Note that you can also combine cube mapping with bump mapping,
as shown in Figure 9.11. This is one of the reasons that, when doing bump
mapping, it is beter to convert the surface local coordinates of the bumps to
eye space, instead of the other way around. This allows the bump mapping
normals to interoperate with the cube map reflect( ) and refract( )
functions.
Render to Texture
Textures need not come only from files or from computation, as our previous
examples have done. You can also render an image into a texture and then use
that image as a texture. For example, you could render a wireframe teapot into
a texture and use that on a moving surface, as shown in Figure 9.12.
Figure 9.11. A reflecting (left) and refracting (right) bump-mapped teapot.
Search WWH ::




Custom Search