home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / graphics / ftpov_2 / Authors / Dirichlet next >
Text File  |  1996-02-27  |  8KB  |  157 lines

  1. These modifications to the POV-Ray 2.2 source code add a suite of
  2. pigment and normal textures based on Dirichlet domains. They may be
  3. used by anybody for private use; anybody with a good compiler (mine
  4. is not - PC real mode only X-( ) who wants to make executables avail-
  5. able to the public may do so. The POV-Ray team, of course, are
  6. particularly welcome to use this code in any way that benefits the
  7. project!
  8.     The harlequin taxi bug from the first release has been corrected;
  9. and the mortar_colour modifier has been added to avoid the kludge of
  10. using color 0.0 from the harlequin colormap for mortar.
  11.  
  12.     The effects are:
  13.  
  14.         harlequin color_map{[..]} wildness <...> mortar <...>
  15.                         [is_2d] [taxi/euclid/fourth]
  16.             A sort of random tesselation with solid colors. By
  17.         default it is made up of irregular polygons; setting wildness
  18.         (see below) to 0 creates a randomly-colored checker texture.
  19.         Harlequin uses a color_map, from which colors are randomly
  20.         chosen. EG: {[0.0 color Red]
  21.                          [0.5 color Red]
  22.                          [0.5 color White]
  23.                          [1.0 color Black]}
  24.         will make half the cells red, and the other half different shades
  25.         of gray ranging from white to black.
  26.             How it's done: Take all the integer lattice points in space.
  27.         Perturb them at random (the scale of this is called "wildness".
  28.         Call these "centers". Divide space into regions so that each
  29.         region contains the points closest to one specific center. Color
  30.         the whole "nearest-neighbour region" (aka "Dirichlet domain",
  31.         "Voronoi region", "Wigner-Seitz cell", etc...) one randomly-
  32.         selected color.
  33.             Uses: Coarse granite. Camouflage greens (with a bit of turb-
  34.         ulence.) Meadows (scale huge, use a greeny-brown color map and
  35.         low wildness) Crazy paving. Abstract murals. Rough-hewn stonework
  36.         (put a translucent layer with colors over a stone texture!)
  37.         Conglomerate stones and some fancy marble (use a bit of turbulence.)
  38.  
  39.             Modifiers (with sample values)
  40.  
  41.                 wildness 0.5
  42.                                     The more wildness, the further from their
  43.             original cubical shape the cells are. Wildnesses over 1 may
  44.             cause strange 'splintered' shapes. Wildnesses near 0 give
  45.             near-cubical cells.
  46.                 The wildness may also be a vector. wildness<1,0,1> would
  47.             give centers perturbed only in the x and z directions; thus
  48.             the cells would look something like the cells of an irregular
  49.             honeycomb, with vertical "walls" but random "roofs".
  50.  
  51.                 mortar 0.1
  52.                         This puts a layer of "mortar" between the cells.
  53.             Parameter = width of layer: so mortar 0.03 is very narrow,
  54.             mortar 0.5 very wide.  (Cells are of approximately unit size.)
  55.             Default is 0.
  56.  
  57.                 mortar_colour White
  58.                         Chooses the color of the mortar. White is the default. In 
  59.              a short-lived first release, color_map(0.0) was used - this was
  60.              not very satisfactory, and created occasional "mortared-over"
  61.              tiles.
  62.  
  63.  
  64.                 is_2D
  65.                              uses only distances in the XY plane. Looks like
  66.             an image map. Useful (a) because it runs faster, (b) because
  67.             if you want to avoid big areas of mortar on a _flat_ surface,
  68.             the 2d verson works better.  No parameter.
  69.  
  70.                 taxi - Uses taxicab metric
  71.                 d = |x1-y1| + |x2-y2| + |x3-y3|
  72.             instead of Euclidean distance to compute the cells. Instead
  73.             of boundaries at all angles, the cell boundaries are all
  74.             planes with orientation <i,j,k> where i,j,k are    taken from
  75.             {-1,0,1}. The effect is zigzag boundaries. Try it...might look
  76.             good for frost or something!
  77.  
  78.                 fourth - Uses the fourth root of the sum of fourth powers
  79.             instead of Euclidean distance. It's somewhere in between the
  80.             effects of the other two metrics.  Good for masonry.
  81.  
  82.                 euclid - This is the default metric - you don't need to
  83.             declare it. It's there just in case.
  84.  
  85.                 turbulence, scale, translate, etc: as usual!
  86.  
  87.         millefiori color_map{[..]} wildness<...> [is_2d] [taxi/euclid/fourth].
  88.                             Imagine getting a whole load of those gobstopper
  89.         candies with layers of different colored sugar, then squeezing
  90.         them together into a big solid mass. Or, to be less revolting,
  91.         imaging fusing together many glass balls with concentric spheres
  92.         of color. Now carve something out of the mass. Like spotted, but
  93.         more polygonal. Uses a color_map in a fairly conventional way.
  94.             How it's done: Do the Dirichlet domain calculation. Don't worry
  95.         about what the nearest center is. Rather, keep track of how much
  96.         nearer you are to the nearest neighbour than to the second-nearest.
  97.         Then use that as the index of a color-map.
  98.             Note that if you use the same modifiers you get the same cell
  99.         boundaries as in harlequin. Useful for layering textures.
  100.             Uses: Decorative "glass". Tortoise-shell. Convection cells in
  101.         a cup of coffee. Cracks in mud. Roads seen from the air. Stones with
  102.         "crazed" pattern. Snake scales.
  103.  
  104.             Modifiers: Same as for harlequin, except for mortar, which has
  105.         no effect. If you want mortar, just leave a one-color band of the
  106.         desired width at the bottom end of the color_map:
  107.  
  108.             color_map{[0.0 color Mortarcolor]
  109.                          [0.1 color Mortarcolor]
  110.                          [0.1 color Othercolor] ...}
  111.  
  112.  
  113.  
  114.         scoops 0.75 mortar 0.2 wildness<...> [is_2d] [taxi/euclid/fourth]
  115.  
  116.                 This is a normal modifier based on the Dirichlet cells. If the
  117.         amount is positive, the middles of the cells appear to bulge out from
  118.         the surface, creating the appearance of a cluster of fused nodules
  119.         (or scoops of ice-cream!)    If it's negative, the middles of the cells
  120.         are 'sucked in', making a surface that appears to have been chipped or
  121.         carved with an ice-cream scoop. [I'm indebted to my wife for finding a
  122.         name that describes both cases. Thanks, Bridget!]
  123.             The scoop curvature is added to the existing curvature. Thus, if
  124.         scoops -1/R is applied to a sphere of radius R, the scooping will
  125.         (to second order) cancel the curvature of the sphere and it will
  126.         appear faceted. However, most curved surfaces do not have uniform
  127.         umbilic curvature at all points - so it won't facet them.
  128.             All modifiers from above apply. The "mortar" is a band at the
  129.         edge of each cell which isn't scooped. Moreover, if the same set
  130.         of modifiers is used, the cell boundaries will coincide - allowing
  131.         colored bulges (stones?) in a flat mortar matrix.
  132.             Typical amounts are from 0.1 to 1. Values much greater than 1 get
  133.         rather unrealistic - but interesting. Sort of like a brain.
  134.             Uses: Mostly strange. Try it on a mirrored sphere.
  135.         Also, it ought to    make a pretty realistic raspberry!
  136.         [With the wave-shaping that has been predicted for POV3,
  137.         maybe pineapples and strawberries too?]
  138.  
  139.             facets 0.1 wildness<...>
  140.                     This is a real faceting operation. I haven't implemented
  141.         variant metrics, though it could [should?] be done. It makes the
  142.         surface of any curved object appear to be broken up into small poly-
  143.         gonal facets. Think of mirror balls, or beaten copper. It works on
  144.         anything, not just spheres. The amount corresponds to the size of
  145.         the facets, proportional to the object. facets 0.01,on any size of
  146.         convex body, will break it into on the rough order of 10,000 facets.
  147.         facets 0.1 will produce around 100 facets. Near 1, it gets rather
  148.         unrealistic; larger values could crash.
  149.             How it works: The original normal is itself a vector,
  150.         lying on the unit sphere. Scale it by 1/amount - it's now on a big
  151.         sphere. Find the Dirichlet center nearest it, and normalize that,
  152.         to get the new normal. The effect is that all the points from a
  153.         region on the surface now have the same normal - so they form a
  154.         facet.
  155.             Uses: Beaten metal, irregular crystals, etc.
  156.  
  157.