For this purpose, we precompute a three-dimensional distance map, which gives a measure of the distance between points in space and the displaced surface. We treat displacement mapping as a ray-tracing problem, beginning with texture coordinates on the base surface and calculating texture coordinates where the viewing ray intersects the displaced surface. In this chapter, we present distance mapping, a technique for adding small-scale displacement mapping to objects in a pixel shader. Per-Pixel Displacement Mapping with Distance Functions
The CD content, including demos and content, is available on the web and for download.Ĭhapter 8.
You can purchase a beautifully printed version of this book, and others in the series, at a 30% discount courtesy of InformIT and Addison-Wesley.
GPU Gems 2 is now available, right here, online.