home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / swirl / README < prev    next >
Encoding:
Text File  |  1994-08-02  |  1.8 KB  |  48 lines

  1.  
  2.  
  3.                                  swirl README
  4.                               
  5.  
  6.                   a texture generator program for texture maps
  7.  
  8.  
  9.                Swirl is a program that repeatedly modifies images 
  10.            in a regular way, and often generates interesting patterns.
  11.     
  12.  
  13.  
  14.     See swirl.doc for details of execution.  
  15.  
  16.     artshow is a demo program that invokes specific interesting textures.
  17.     
  18.  
  19.  
  20.     
  21.     I was trying to find some simple algorithms that generate interesting
  22.     patterns that could possibly be used as textures for texture maps, etc. 
  23.     All of the patterns produced wrap from top to bottom, and left to right.
  24.     
  25.     Swirl works as follows:  For each pixel (i, j) I keep 5 values -- the R,
  26.     G, and B components, and two floats, dx(i, j) and dy(i, j).  Typically,
  27.     the floats are small (on the order of -15 to 15).  Generation n+1 is
  28.     calculated from generation n as follows:
  29.     
  30.         At the pixel (i, j), find dx = dx(i, j) and dy = dy(i, j).
  31.     
  32.         Find the color (in generation n) of pixel (i+dx, j+dy).  Since
  33.         dx and dy are, in general, floats, do the appropriate filtering.
  34.         (If you go off the image, just wrap to the opposite side.)
  35.     
  36.         Assign this new color to the pixel (i, j) in generation n+1.
  37.     
  38.     Basically, the dx and dy values form a 2-D vector field that indicate
  39.     the flow direction (actually the negative of that).  If the dx and dy
  40.     are sinusoidal, you'll get swirling.  You can also do shearing,
  41.     electric attractive and repulsive fields, etc.
  42.     
  43.     
  44.     Suggestions welcome; bugs to /dev/null.  The code may change, but I'll
  45.     add features using higher numbers for starting values and dx and dy
  46.     specifications.
  47.                                            -- Tom Davis (davis@sgi.com)
  48.