home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Raytrace & Morphing / SOS-RAYTRACE.ISO / programm / raytrace / polyray / dat / animate / thresh / mirblb.pi < prev    next >
Encoding:
Text File  |  1994-02-22  |  5.4 KB  |  193 lines

  1. //
  2. // Animation of mirrored blobs & glass balls rotating around.  Recommend
  3. // tracing this at as high a resolution as you have disc space for.  At
  4. // the default image size of 320x240, 200 frames, 16 bpp and DTA to crunch
  5. // the frames, you will get a FLI of around 3.9 Meg.
  6. //
  7. // Polyray data file: Alexander Enzmann
  8. //
  9. // Define the range of the animation, for smoother results use a higher
  10. // value of "end_frame".  For coarser animations make it smaller.
  11. //
  12. start_frame  0
  13. end_frame    200
  14. total_frames 201
  15. outfile mirb
  16.  
  17. // Build the interpolation variable
  18. define t0 0
  19. define t1 total_frames
  20. define increment frame / (t1 - t0)
  21.  
  22. // Set up the camera
  23. viewpoint {
  24.    from rotate(<0, 10, -20>, <0, 1, 0>, 35)
  25.    at <0,0,0>
  26.    up <0,1,0>
  27.    angle 45
  28.    resolution 480, 360
  29.    aspect 4/3
  30.    }
  31.  
  32. // Set up background color & lights
  33. background 0.7 * orange
  34. light 0.8 * white, <-30,30,-50>
  35. light 0.8 * white, < 10,20,-50>
  36.  
  37. define glass
  38. texture {
  39.    surface {
  40.       ambient 0
  41.       diffuse 0
  42.       specular 0.1
  43.       reflection white, 0.1
  44.       microfacet Cook 5
  45.       transmission white, 0.8, 1.5
  46.       }
  47.    }
  48.  
  49. define mirror
  50. texture {
  51.    surface {
  52.       ambient white, 0.05
  53.       diffuse white, 0.05
  54.       specular 0.1
  55.       microfacet Cook 5
  56.       reflection white, 0.8
  57.       }
  58.    }
  59.  
  60. // The blob components move at two rates of speed.  By basing the speed of
  61. // rotation on the number of degrees in a circle and the number of times it
  62. // will go around the circle, we can make the blob component whirl around.
  63. //
  64. // The value of "increment" varies from 0 to 1 over the course of the animation,
  65. // so the result of the two definitions below makes angles that go either
  66. // twice or three times around a circle during the course of the animation.
  67. define speed1 2 * increment * 360
  68. define speed2 3 * increment * 360
  69.  
  70. //
  71. // The blob components are located on the points of equilateral triangles.
  72. // There is a triangle lying in each of the three standard planes (xy, xz, yz).
  73. //
  74. define loc01 rotate(< 6, 0, 0>, <0, 0, 1>, speed1)
  75. define loc02 rotate(< 6, 0, 0>, <0, 0, 1>, speed2)
  76. define loc03 rotate(< 6, 0, 0>, <0, 0, 1>, 120 + speed1)
  77. define loc04 rotate(< 6, 0, 0>, <0, 0, 1>, 120 + speed2)
  78. define loc05 rotate(< 6, 0, 0>, <0, 0, 1>, 240 + speed1)
  79. define loc06 rotate(< 6, 0, 0>, <0, 0, 1>, 240 + speed2)
  80. define loc07 rotate(< 0, 6, 0>, <1, 0, 0>, speed1)
  81. define loc08 rotate(< 0, 6, 0>, <1, 0, 0>, speed2)
  82. define loc09 rotate(< 0, 6, 0>, <1, 0, 0>, 120 + speed1)
  83. define loc10 rotate(< 0, 6, 0>, <1, 0, 0>, 120 + speed2)
  84. define loc11 rotate(< 0, 6, 0>, <1, 0, 0>, 240 + speed1)
  85. define loc12 rotate(< 0, 6, 0>, <1, 0, 0>, 240 + speed2)
  86. define loc13 rotate(< 0, 0, 6>, <0, 1, 0>, speed1)
  87. define loc14 rotate(< 0, 0, 6>, <0, 1, 0>, speed2)
  88. define loc15 rotate(< 0, 0, 6>, <0, 1, 0>, 120 + speed1)
  89. define loc16 rotate(< 0, 0, 6>, <0, 1, 0>, 120 + speed2)
  90. define loc17 rotate(< 0, 0, 6>, <0, 1, 0>, 240 + speed1)
  91. define loc18 rotate(< 0, 0, 6>, <0, 1, 0>, 240 + speed2)
  92.  
  93. //
  94. // Now we make the blob out of spherical components sitting at the locations
  95. // that were defined above.
  96. //
  97. object {
  98.    blob 0.8:
  99.       sphere loc01, 1, 3,
  100.       sphere loc02, 1, 3,
  101.       sphere loc03, 1, 3,
  102.       sphere loc04, 1, 3,
  103.       sphere loc05, 1, 3,
  104.       sphere loc06, 1, 3,
  105.       sphere loc07, 1, 3,
  106.       sphere loc08, 1, 3,
  107.       sphere loc09, 1, 3,
  108.       sphere loc10, 1, 3,
  109.       sphere loc11, 1, 3,
  110.       sphere loc12, 1, 3,
  111.       sphere loc13, 1, 3,
  112.       sphere loc14, 1, 3,
  113.       sphere loc15, 1, 3,
  114.       sphere loc16, 1, 3,
  115.       sphere loc17, 1, 3,
  116.       sphere loc18, 1, 3
  117.    mirror
  118.    }
  119.  
  120. //
  121. // Just for fun, there are six glass balls inside the blob components.  Each
  122. // ball sits at the vertex of an octahedron.  As the animation progresses the
  123. // balls rotate around.
  124. //
  125. object {
  126.      object { sphere < 3, 0, 0>, 1 glass }
  127.    + object { sphere <-3, 0, 0>, 1 glass }
  128.    + object { sphere < 0, 3, 0>, 1 glass }
  129.    + object { sphere < 0,-3, 0>, 1 glass }
  130.    + object { sphere < 0, 0, 3>, 1 glass }
  131.    + object { sphere < 0, 0,-3>, 1 glass }
  132.    rotate <speed1, speed2, 0>
  133.    }
  134.  
  135. // Now to make a floor.  Pretty standard sort of thing, a big disc with
  136. // several colorful textures.
  137. define cloudy_sky
  138. texture {
  139.    noise surface {
  140.       ambient 0.9
  141.       diffuse 0
  142.       specular 0
  143.       turbulence 6.0
  144.       position_fn 2
  145.       lookup_fn 1
  146.       octaves 4
  147.       color_map(
  148.      [0.0, 0.6, <0.4, 0.4, 0.4>, <1, 1, 1>]
  149.      [0.6, 0.8, <1, 1, 1>, <0.196078, 0.6, 0.8>]
  150.      [0.8, 1.0, <0.196078, 0.6, 0.8>, <0.196078, 0.6, 0.8>])
  151.       }
  152.    }
  153.  
  154. define blue_ripple
  155. texture {
  156.    noise surface {
  157.       color <0.4, 0.4, 1.0>
  158.       normal 2
  159.       frequency 100
  160.       bump_scale 2
  161.       ambient 0.3
  162.       diffuse 0.4
  163.       specular white, 0.7
  164.       microfacet Reitz 10
  165.       }
  166.    scale <10, 1, 10>
  167.    }
  168.  
  169. // Sorta marble-like texture.  Couldn't decide what to call it...
  170. define thingy
  171. texture {
  172.    noise surface {
  173.       ambient 0.4
  174.       diffuse 0.6
  175.       specular white, 0.2
  176.       microfacet Cook 4
  177.       position_fn 1
  178.       position_scale 1.1
  179.       lookup_fn 1
  180.       octaves 3
  181.       turbulence 2
  182.       color_map(
  183.          [0.0, 0.3, <0.2, 0.7, 0.9>, <0.3, 0.6, 0.8>]
  184.          [0.3, 1,   <0.1, 0.6, 0.8>, <0.05, 0.4, 0.4>])
  185.       }
  186.    scale <0.3, 0.3, 0.3>
  187.    }
  188.  
  189. object {
  190.    disc <0, -10, 0>, <0, 1, 0>, 1000
  191.    texture { hexagon blue_ripple, thingy,  cloudy_sky scale <20, 20, 20> }
  192.    }
  193.