 
 
 
 
 
 
 
  
 Next: 6.21.8 Generating 3D Noise
 Up: 6.21 Procedural Texture Generation
 Previous: 6.21.6 Turbulence
 
 
6.21.7 Example: Image Warping
A common use of
a 2D noise texture is to distort the texture coordinates while 
drawing a 2D image, thus warping the image.  A noise function is created
in the framebuffer as described above, read back to the host, and used
as texture coordinates (or offsets to texture coordinates) to render 
the image.  Since color values in OpenGL are normalized to the range 0.0
to 1.0, if one is careful the image returned to the host may be used 
without much conversion; assuming that the modelview and texture matrixes
are set up to accept values in this range, the returned data may be used
directly for rendering.
Another similar use of a 2D noise texture is to distort the reflection of
an image.  In OpenGL, reflections on a flat surface can be done by reflecting
a scene across the surface.  The results can be copied from the 
framebuffer to texture memory, and in turn drawn with distorted texture 
coordinates.  The shape and form of the distortion can be controlled by 
modulating the contents of the framebuffer after the noise texture 
is drawn but before it is copied to texture memory.  This can produce
interesting effects such as water ripples.
 
 
 
 
 
 
 
  
 Next: 6.21.8 Generating 3D Noise
 Up: 6.21 Procedural Texture Generation
 Previous: 6.21.6 Turbulence
David Blythe
1999-08-06