home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #7 / amigamamagazinepolishissue1998.iso / varia / povray3 / povray3_060 / pov3demo / showoff / swirlbox.pov < prev    next >
Text File  |  1997-12-12  |  3KB  |  111 lines

  1. // Persistence Of Vision raytracer version 3.0 sample file.
  2. // File: SwirlBox.POV
  3. // Vers: 3
  4. // Desc: Stacked square rings in a snail shell shape,
  5. //       shows off the use of the while loop for creating objects,
  6. //       and for smoothly changing colors.
  7. // Date: 10/1/95
  8. // Auth: Eduard Schwan
  9.  
  10. #version 3.0
  11. global_settings { assumed_gamma 1.0 }
  12.  
  13. // ------------------------------------------------------------------
  14. // Look down at an angle at our creation
  15. camera
  16.   location  < 4, 9,-20>
  17.   direction  1*z
  18.   look_at   < 0,-1, 8>
  19.  
  20.  
  21. // ------------------------------------------------------------------
  22. // A white marble floor
  23. plane
  24. {
  25.   y, -0.1
  26.   texture
  27.   {
  28.     pigment
  29.     {
  30.       marble
  31.       turbulence 0.5 omega 0.7 rotate -40*y scale 6
  32.       color_map
  33.       {
  34.         [0.50 color rgb 1.0]
  35.         [0.57 color rgb 0.8]
  36.         [0.60 color rgb <0.9,0.8,0.7>]
  37.         [0.63 color rgb 1.0]
  38.       }
  39.     }
  40.     finish {ambient 0.2 reflection 0.3}
  41.   }
  42. }
  43.  
  44.  
  45. // ------------------------------------------------------------------
  46. // Simple background for a simple scene
  47. background { color rgb <0.0, 0.1, 0.2> }
  48.  
  49.  
  50. // ------------------------------------------------------------------
  51. // A light source
  52. light_source { <50, 20, -50> color rgb 1 }
  53.  
  54.  
  55. // ------------------------------------------------------------------
  56. // create a simple square ring shape 
  57. #declare BasicShape = intersection
  58. {
  59.   // flat pizza box
  60.   box { -1, +1 scale <1.0, 0.1, 1.0> }
  61.   // remove square hole in middle
  62.   box { -1, +1 scale <0.95, 1.1, 0.95> inverse }
  63. }
  64.  
  65.  
  66. // ------------------------------------------------------------------
  67. // Set up the loop variables:
  68. // the Counter variable will go from 0.0 to 1.0
  69. // in NumIterations loops.
  70. #declare NumIterations = 80  // try different numbers of boxes (20,40,80...)
  71. // don't change these
  72. #declare Counter       = 0.0
  73. #declare Increment     = 1.0/NumIterations
  74. #declare NumTwists     = 360*2 // two full twists
  75.  
  76.  
  77. // ------------------------------------------------------------------
  78. // Create an iterated object built from our basic shape
  79. union{
  80.   #declare Flipper = 0  // Flipper will switch between 0 and 1 each loop
  81.   #while (Counter<=1.0)
  82.     object
  83.     {
  84.       BasicShape
  85.       // boxes get smaller as we stack them up
  86.       scale <(1-Counter)*5,1,(1-Counter)*5>
  87.       // boxes get closer to center and stack upward as we go
  88.       translate <(1-Counter)*5, Counter*10, 0.0>
  89.       // rotate each box a little more as they stack
  90.       rotate NumTwists*Counter*y
  91.       // put down the texture
  92.       texture
  93.       {
  94.         pigment
  95.         {
  96.           // colors change as we stack them up
  97.           color rgb <1-Counter, Flipper, Counter>
  98.         }
  99.         finish { ambient 0.2 specular 0.7 roughness 0.05 }
  100.       }
  101.     }
  102.     #declare Flipper = 1 - Flipper // flip its value (0->1 or 1->0)
  103.     // manually increment our counter inside the loop
  104.     #declare Counter=Counter+Increment
  105.   #end
  106. }
  107.  
  108.  
  109.