next up previous contents
Next: 6.21.5 Other Noise Functions Up: 6.21 Procedural Texture Generation Previous: 6.21.3 High Resolution Filtering   Contents

6.21.4 Spectral Synthesis

Now that we can create a single frequency noise function using the framebuffer, we need to create the different octaves and to composite them into one texture. For each octave:
  1. Scale the texture matrix by a power of 2 in both $s$ and $t$.
  2. Translate the texture matrix by a random offset in both $s$ and $t$.
  3. Set the texture wrap mode to GL_ REPEAT for $s$ and $t$.
  4. Draw a textured rectangle.
  5. Accumulate the color buffer contents.
The random translation is an attempt to minimize the amount of overlap between each octave's texels; without it, every octave would use texels from the same corner of the input image. The accumulation is typically done with a scale factor that controls the weight we want to give each octave.