home *** CD-ROM | disk | FTP | other *** search
/ Shareware Supreme Volume 6 #1 / swsii.zip / swsii / 279 / POVSCN20.ZIP / MAGGLASS.POV < prev    next >
Text File  |  1993-09-28  |  2KB  |  95 lines

  1. // Persistence of Vision Raytracer
  2. // Magnifying glass created using POV-Ray's refraction.
  3. // A convex lens created with CSG 
  4. // (and something to view through it)
  5. // This example doesn't work very well, but it gives a good 
  6. // starting point for a better use of the magnifying glass.
  7.  
  8.  
  9. #include "colors.inc"
  10. #include "shapes.inc"
  11. #include "textures.inc"
  12. #include "fov.inc"                  // Field of view constants
  13. #include "ior.inc"                  // Index of refraction constants
  14.  
  15. camera {
  16.    location <0.0, 2, -10>
  17.    direction <0.0, 0.0, FoV_60>     // 60o field of view
  18.    up  <0.0, 1.0, 0.0>
  19.    right <4/3, 0.0, 0.0>
  20.    look_at <0, 0, 0>
  21. }
  22.  
  23. light_source { <30, 50, -50> color White }
  24.  
  25. light_source { <-30, 10, 20> color Gray50 }
  26.  
  27. fog { color Gray50 distance 200 }  // This fog reaches max density at 200z
  28.  
  29. // Background sphere
  30. sphere { <0, 0, 0>, 1
  31.      finish { crand 0.015 }
  32.      pigment {
  33.         gradient y
  34.         color_map {
  35.             [0.0 1.0 color Gray80 color Gray30]
  36.         }
  37.         scale 10000
  38.     }
  39. }
  40.  
  41. // A lens.  This uses the Ellipsoid quadric to make it independantly
  42. // scalable, but it would be faster to use spheres.
  43. // It is designed "sideways" so you can see the thickness.
  44. // It is then rotated 90o on Y so the viewer is looking through the lens.
  45. #declare Lens_Thickness = 0.35
  46. #declare Lens_Diameter = 1.5
  47.  
  48. #declare Lens =
  49. intersection {
  50.    sphere { <0, 0, 0>, 1.5 translate <0.75, 0, 0> }
  51.    sphere { <0, 0, 0>, 1.5 translate <-0.75, 0, 0> }
  52.  
  53.    texture {
  54.        Glass2                           // Try Glass and Glass3, too
  55.        finish {
  56.           ior Flint_Glass_Ior           // Over-ride the Glass IOR value
  57.           reflection 0                  // Over-ride reflection, too
  58.        }
  59.    }
  60.  
  61.    scale <Lens_Thickness, Lens_Diameter, Lens_Diameter>
  62. }
  63.  
  64.  
  65. plane { y, -4
  66.     pigment {
  67.        checker color HuntersGreen color SummerSky
  68.        scale <3, 1, 3>
  69.     }
  70.     finish {
  71.        ambient 0.2
  72.        diffuse 0.6
  73.     }
  74. }
  75.  
  76. object { Lens rotate 80*y }
  77.  
  78. // A sphere in the distance
  79. sphere { <3, 1, 30>, 2 finish {Phong_Shiny} pigment {Orange} }
  80.  
  81. object { Cylinder_X
  82.    finish {
  83.       Phong_Shiny
  84.       ambient 0.25
  85.       diffuse 0.6
  86.    }
  87.    pigment {
  88.       granite
  89.       scale 2
  90.    }
  91.  
  92.     rotate -75*y
  93.     translate <0 ,-3, 25>
  94. }
  95.