home *** CD-ROM | disk | FTP | other *** search
/ ANews 3 / AnewsCD3.iso / atari / GRAPHX / POV / 68030.060 / POV31G30 / POVRAY_3.1G / SCENES / ADVANCED / WHILTILE.POV < prev    next >
Text File  |  1999-10-30  |  5KB  |  182 lines

  1. // Persistence Of Vision raytracer version 3.1 sample file.
  2. // File: WhilTile.POV 10/01/95
  3. // Auth: Eduard Schwan with modifications by Dan Farmer
  4. // Desc: A tile floor, using the 'while' loop and 'if' statements
  5. //       to create a unique pattern automatically.
  6.  
  7. // Enable this next line to use a simpler test shape for debugging
  8. // #declare DO_SIMPLE_SHAPE = 1;
  9.  
  10.  
  11. global_settings { assumed_gamma 1.0 }
  12.  
  13. #include "colors.inc"
  14. #include "woods.inc"
  15.  
  16. // ------------------------------------------------------------------
  17. // set viewer's position in the scene
  18. camera {
  19.   location  <0.0, 22.0, -24.0> // position of camera <X Y Z>
  20.   direction 4.0*z              // which way are we looking <X Y Z>
  21.   up        y                  // which way is +up <X Y Z>
  22.   right     4/3*x              // which way is +right <X Y Z> and aspect ratio
  23.   look_at   <0.0, 0.0, -1.0>   // point center of view at this point <X Y Z>
  24. }
  25.  
  26. // ------------------------------------------------------------------
  27. // create a regular point light source
  28. light_source { <10, 10, -10> color rgb 1 translate <-20, 40, -20> }
  29.  
  30.  
  31. // ------------------------------------------------------------------
  32. #declare TileShape =
  33. #ifdef (DO_SIMPLE_SHAPE)
  34.   // simpler shape for debugging
  35.   sphere{0, 1 scale <0.5,0.1,0.5> translate 0.1*y}
  36. #else
  37.   // real tile shape
  38.   intersection  {
  39.     box { -1, 1 }  // square tile
  40.     cylinder { -2*x, +2*x, 0.9 } // rounded edges along X axis
  41.     cylinder { -2*z, +2*z, 0.9 } // rounded edges along Z axis
  42.     sphere { 0, 2.0 translate 2.6*y inverse }  // concave top surface
  43. //  sphere { 0, 1.1 } // rounded corners
  44. //  bounded_by { box { -1, 1 } }
  45.     scale <0.5,0.2,0.5>  // flatten the tile down on Y axis
  46. //    translate 0.2*y  // move it up so its bottom is on origin
  47.   }
  48. #end
  49.  
  50. // ------------------------------------------------------------------
  51. default {
  52.   texture { pigment {rgb 1} finish {ambient 0.2 reflection 0.2 specular 0.7} }
  53. }
  54.  
  55. // light tinted glass
  56. #declare CrystalTex =
  57. texture {
  58.   pigment { rgbf <1.00, 0.70, 0.70, 0.95> }
  59.   finish {roughness 0.001 }
  60. }
  61.  
  62. #declare CrystalInt =
  63. interior {ior 1.8}
  64.  
  65. // Black slate marble with white strata
  66. #declare SlateTex =
  67. texture {
  68.   pigment {
  69.     marble
  70.     turbulence 0.8 rotate 60*y
  71.     color_map {
  72.       [0.10 rgb 0.01]
  73.       [0.12 rgb 0.70]
  74.       [0.15 rgb 0.01]
  75.       [0.20 rgb 0.01]
  76.       [0.30 rgb <0.9,0.7,0.6>]
  77.       [0.50 rgb 0.01]
  78.     }
  79.     scale 0.4
  80.   }
  81.   finish {reflection 0.2}
  82. }
  83.  
  84. // green crackle
  85. #declare CrackleTex =
  86. texture {
  87.   pigment { color rgb <0.1, 0.5, 0.1> }
  88.   normal {crackle 0.5 turbulence 0.2 scale 0.3}
  89. }
  90.  
  91. // brown/blue pinwheel radial pattern
  92. #declare PinwheelTex =
  93. texture {
  94.   pigment {
  95.     radial
  96.     frequency 8
  97.     color_map {
  98.       [0.00 blue 0.4]
  99.       [0.50 blue 0.4]
  100.       [0.60 rgb <0.5,0.6,0.9>]
  101.     }
  102.   }
  103. }
  104.  
  105. #declare MSetTex =
  106. texture {
  107.   pigment {
  108.     mandel 100
  109.     color_map {
  110.       [0.0  color MidnightBlue ]
  111.       [0.2  color Yellow  ]
  112.       [0.6  color Scarlet ]
  113.       [0.8  color Magenta ]
  114.       [1.0  color Gray10 ]
  115.     }
  116.     scale .25
  117.     rotate x*90
  118.     translate x*0.225
  119.     //rotate y*45
  120.   }
  121. }
  122.  
  123. // ------------------------------------------------------------------
  124. // declare the set of tiles as a union built by a loop
  125. #declare Max  = 16;     // # of tiles across and down
  126. #declare XMax = Max/2;
  127. #declare ZMax = Max/2;
  128.  
  129. #declare ZCount = -ZMax;
  130.  
  131. #declare Tile_Set =
  132. union {
  133.     #while (ZCount <= ZMax)
  134.  
  135.       #declare XCount = -XMax;
  136.       #while (XCount <= XMax)
  137.  
  138.       object {
  139.         TileShape
  140.         #if(XCount=0 & ZCount=0)
  141.         // Center tile
  142.           texture { MSetTex }
  143.         #else
  144.           #if (abs(XCount) = abs(ZCount))
  145.             // An "X" pattern of tiles, diagonal through origin
  146.             texture { CrystalTex }
  147.             interior { CrystalInt }
  148.           #else
  149.             #if (abs(XCount)*abs(ZCount) < XMax)
  150.               // A "fat plus" pattern, centered on origin
  151.               texture {
  152.                 SlateTex
  153.                 rotate (XCount+ZCount)*10*y
  154.                 translate <-XCount, 0, -ZCount>  // alter texture per tile
  155.               }
  156.             #else
  157.               #if (abs(mod(XCount,3)) = abs(mod(ZCount,2)))
  158.               // An alternating sprinkle of remaining tiles
  159.               texture {
  160.                 CrackleTex
  161.                 translate <-XCount, 0, -ZCount>  // alter texture per tile
  162.               }
  163.               #else
  164.                 texture { PinwheelTex }
  165.               #end
  166.             #end
  167.           #end
  168.         #end
  169.         translate <XCount, 0, ZCount>
  170.       }
  171.  
  172.       #declare XCount = XCount+1;
  173.       #end  // Inner X loop
  174.  
  175.     #declare ZCount = ZCount+1;
  176.     #end  // Outer Z loop
  177. }
  178.  
  179. // ------------------------------------------------------------------
  180. // make the tile object
  181. object { Tile_Set rotate y*30}
  182.