Next: 6.21.4 Spectral Synthesis
Up: 6.21 Procedural Texture Generation
Previous: 6.21.2 Generating Noise Functions
  Contents
The accumulation buffer can be used to convolve a high resolution filter
with a relatively small image under magnification. That is what we need to
make the different octaves; the octave representing the lowest
frequency band will be created from a very small input image under large
magnification. Suppose we want to create a 512x512 output image by convolving
a 64x64 filter with a 4x4 input image. Our filter takes a 2x2 array of samples
from the input image at a time, but is discretized into 64x64 values in order
to generate an output image of the desired size.
The input image is shown on the left in
Figure 43 with each texel numbered. The output image is
shown on the left in Figure 44. Note that each texel of
the input image will make a contribution to a 64x64 region of the output
image. Consider these regions for texels 5, 7, 13, and 15 of the input
image; they are adjacent to each other and have no overlap, as shown
by the dotted lines on the left in Figure 44. Hence,
these four texels can be evaluated in the same pass without interfering with
each other. Making use of this fact, we
redistribute the texels of the input image into four 2x2 textures as shown
in the right of Figure 43. We also create a 64x64 texture
that contains the filter function; this texture will be used to modulate the
contribution of the input texel over a 64x64 region of the color buffer. The
steps to evaluate the texels in Texture are:
- Using the filter texture, draw four filter functions into the alpha
planes with the appropriate and offset, as shown on the right in
Figure 44.
- Enable alpha blending and set the source blend factor
to GL_ DST_ALPHA
and the destination blend factor to GL_ ZERO.
- Set the texture magnification filter to GL_ NEAREST.
- Draw a rectangle to the dotted region with Texture D, noting the offset
of 64 pixels in both and .
- Accumulate the result into the accumulation buffer.
Repeat the above procedure for Textures , , and with the appropriate
and offsets, and return the contents of the accumulation buffer to the
color buffer.
A wider filter requires more passes of the above procedure, and also requires
that the original texture be divided into more small textures.
For example, if we had chosen a filter that covers a 4x4 array of input
samples instead of 2x2, we would have to make 16 passes instead of 4,
and we would have to distribute the texels into 16 1x1 textures.
Increasing the size of either the output image or the input image, however,
has no effect on the number of passes.
Next: 6.21.4 Spectral Synthesis
Up: 6.21 Procedural Texture Generation
Previous: 6.21.2 Generating Noise Functions
  Contents
2001-01-10