home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 1995 January / pcw-0195.iso / polyray / dat / misc / chain.pi < prev    next >
Text File  |  1994-12-31  |  2KB  |  86 lines

  1. // Generic Polyray input File
  2. // Polyray input file: Alexander Enzmann
  3.  
  4. // Set up the camera
  5. viewpoint {
  6.    from <0, 30, -20>
  7.    at   <0, 0,  0>
  8.    up   <0, 1,  0>
  9.    angle 30
  10.    resolution 320, 240
  11.    aspect 4/3
  12.    }
  13.  
  14. // Get various surface finishes
  15. include "..\colors.inc"
  16.  
  17. // Set up background color & lights
  18. background midnight_blue
  19. light 0.7 * white, <-10, 30, -20>
  20. light 0.7 * white, < 10, 30, -20>
  21.  
  22. // Link of a chain.  Extends from -1.2 to 1.2, width is 0.7, height is 0.2
  23. define link
  24. object {
  25.      (  object { torus 0.5, 0.2, <-0.5, 0, 0>, <0, 1, 0> }
  26.       - object { disc <-0.5, 0, 0>, <-1, 0, 0>, 1 })
  27.    + object { cylinder <-0.5, 0,-0.5>, <0.5, 0,-0.5>, 0.2 }
  28.    + object { cylinder <-0.5, 0, 0.5>, <0.5, 0, 0.5>, 0.2 }
  29.    + (  object { torus 0.5, 0.2, < 0.5, 0, 0>, <0, 1, 0> }
  30.      - object { disc <0.5, 0, 0>, <1, 0, 0>, 1 })
  31.    }
  32.  
  33. define half_link
  34. object {
  35.      (  object { torus 0.5, 0.2, <1, 0, 0>, <0, 0, 1> }
  36.       - object { disc <1, 0, 0>, <-1, 0, 0>, 1 })
  37.    + object { cylinder <1, -0.5, 0>, <1.5, -0.5, 0>, 0.2 }
  38.    + object { cylinder <1,  0.5, 0>, <1.5,  0.5, 0>, 0.2 }
  39.    }
  40.  
  41. // 1 and 2 half links of a chain, built to be put into a gridded object
  42. define grid_link
  43. object {
  44.      half_link { rotate <0, 180, 0> } // Half link on the left
  45.    + link                             // Full link
  46.    + half_link                        // Half link on the right
  47.    }
  48.  
  49. // Reasonable metallic brass texture
  50. define brass_color  <0.71, 0.65, 0.26>
  51. define brass
  52. texture {
  53.    surface {
  54.       color brass_color
  55.       ambient 0.2
  56.       diffuse 0.7
  57.       specular brass_color, 0.75
  58.       microfacet Phong 10
  59.       reflection 0.75
  60.       }
  61.    }
  62.  
  63. // Several rows of chains made up of individual links - the gridded object
  64. // makes it easier to assemble.
  65. object {
  66.    gridded "allwhite.tga",
  67.       grid_link { scale <1/3,1/3,1/3> translate <0.5, 0.5, 0.5> brass }
  68.    translate <-15, 0, -15>
  69.    scale <4, 4, 4>
  70.    rotate <0, 30, 0>
  71.    }
  72.  
  73. // Checkered floor
  74. object {
  75.    disc <0, -2, 0>, <0, 1, 0>, 100
  76.    texture { checker matte_white, matte_black scale <4, 4, 4> }
  77.    }
  78.  
  79. // Bumpy glass surface - acts as a ripply lens to the chains below
  80. object {
  81.    smooth_height_fn 200, 200, -2, 2, -2, 2, 0.1 * sin(18.85 * x * z)
  82.    scale <8, 1, 8>
  83.    translate <0, 5, 0>
  84.    glass
  85.    }
  86.