Graphics Reference
In-Depth Information
tions in an unsigned-byte texture, but in doing so,
you would first need to quantize the entire range of
heights into the range 0-255. When GLSL samples
this type of texture, it returns a range of 0. (corre-
sponding to the unsigned byte 0) to 1. (correspond-
ing to 255). To un-quantize these elevations, they
must be multiplied by the maximum height. By
using pre-processor directives, this shader code can
handle it both ways.
As we discussed before, one of the great things
about bump-mapping is that it is performed per-
pixel. This means that as you zoom in, you just keep
sampling the elevation texture finer and finer. In this
example, we used a 2048 × 1152 texture, so we are
able to zoom in quite a bit, as shown in Figure 15.28. 4
Figure 15.28. Zooming on the Willamete
Valley, Oregon, USA.
Flow Visualization
Flow visualization is a common problem in scientific visualization that arises
when simulating moving fluids or particles. In these cases, it is useful to
show the paths that are being taken as the fluid or particles move through the
volume.
2D Line Integral Convolution
Cabral and Leedom were the first to demonstrate the line integral convolution
(LIC) technique [6] that smears the pixels of an image in the direction of a 2D
flow field and thus shows the entire flow field at a glance. This algorithm can
be implemented well in a fragment shader. Typically, this fragment shader
takes two input image textures, one for the base image and one that has had
the flow field function encoded in it. Let's look at this base image texture first.
The base image is going to be smeared in the direction of the flow at each
pixel. We almost don't care what this base image is. It is usually white noise,
but it can also be your favorite personal photo as well. The biggest concern is
that there are no distinct paterns in it that might be mistaken for low informa-
tion. This is why white noise is such a good choice.
4. To create this texture, we wrote a software tool that takes a longitude-latitude range from the US
Geological Survey National Elevation Dataset (USGS-NED) [44] and creates the .tex file.
 
Search WWH ::




Custom Search