i
i
i
i
i
i
i
i
472 10. Image-Based Effects
ing the relative size of the filter kernel. For example, applying a kernel
with a width of five (i.e., two texels to each side of the central pixel) to the
smaller image is similar in effect to applying a kernel with a width of nine
to the original image. Quality will be lower, but for blurring large areas
of similar color, a common case for many glare effects and other phenom-
ena, most artifacts will be minimal. The main problem is flickering during
animation [602].
One last process is worth mentioning: ping-pong buffers [951]. This
term is commonly used in GPU image processing. It is simply the idea
of applying operations between two offscreen buffers, each used to hold
intermediate or final results. For the first pass, the first buffer is the input
texture and the second buffer is where output is sent. In the next pass the
roles are reversed, with the second now acting as the input texture and the
first getting reused for output. In this second pass the first buffer’s original
contents are overwritten—it is just being reused as temporary storage for
a processing pass.
The field of animation is beyond the scope of this volume, but it should
be noted that the GPU can also assist in performing texture animation
via image processing. For example, James [600] first showed how a variety
of animated effects can be done by modifying textures on the GPU from
frametoframe. Thatis,atextureimage can be modified by a pixel shader
and the result rendered on a surface. Then in the next frame, the result
is modified again by the same pixel shader and rendered. Using one- and
two-dimensional cellular automata rules, effects such as fire, smoke, and
interactive rippling water can be created on a surface. Textures created
can be used to modify the surface color, shading normal, heightfield, or
any other attributes. Many articles have been written about performing
fluid flow animation on the GPU; see Sanders et al. [1108] for a summary of
past work in this area, along with a presentation of their own optimization
technique. Tatarchuk’s article on simulating rain [1246] is noteworthy for
its innovative use of a wide range of techniques. Crane et al. [205] discuss
three-dimensional fluid flow, a topic touched upon later in Section 10.16
on volume rendering.
A type of filter that has seen much recent use in graphics and related
fieldsisthebilateral filter. This filter uses not only the distance between
the texel and central pixel for weighting, but the difference in their values
as well. This results in a “smart blur” that preserves sharp edges. The
recent SIGGRAPH course on the subject [988] is a good overview of the
bilateral filter and its applications.
Pixel shaders can be used in post processing to imitate thermal imag-
ing [549], reproduce film grain [928], perform edge detection [95, 370, 877],
generate heat shimmer [928] and ripples [28], posterize an image [28], render
clouds [55], simulate VCR playback and rewind [254], and for a huge num-