home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / p / ply15dat.zip / CWHEEL.PI < prev    next >
Text File  |  1992-09-01  |  3KB  |  115 lines

  1. // Demonstration of a number of the texturing capabilities of Polyray.
  2. // Polyray input file: Alexander Enzmann
  3.  
  4. define otheta 0
  5.  
  6. viewpoint {
  7.    from <0, 5, -12>
  8.    at <0,0,0>
  9.    up <0,1,0>
  10.    angle 45
  11.    resolution 256, 160
  12.    aspect 1.6
  13.    }
  14.  
  15. background SkyBlue
  16. light <-10,10,-10>
  17. light < 10,10,-10>
  18.  
  19. // Ripple the x and y components of the surface normal
  20.  
  21. define x_mirror_curve (cos(3.14 * x) + 1) / 2
  22. define y_mirror_curve (cos(3.14 * y) + 1) / 2
  23. define rippled_xy_mirror
  24. texture {
  25.    special surface {
  26.       color white
  27.       normal <N[0] + 0.2 * (cos(7 * x) + 1 + otheta) / 2,
  28.               N[1] + 0.5 * sin(y_mirror_curve + otheta),
  29.               N[2]>
  30.       ambient 0.1
  31.       diffuse 0.2
  32.       reflection 0.7 * y_mirror_curve
  33.       }
  34.    }
  35.  
  36. // Create a solid texture based on sin functions
  37.  
  38. define sin_color_offset (sin(3.14 * fmod(x*y*z, 1) + otheta) + 1) / 2
  39. define sin_color <sin_color_offset, 0, 1 - sin_color_offset>
  40. define xyz_sin_texture
  41. texture {
  42.    special surface {
  43.       color sin_color
  44.       ambient 0.2
  45.       diffuse 0.7
  46.       specular white, 0.2
  47.       microfacet Reitz 10
  48.       }
  49.    }
  50.  
  51. // Create a solid texture based on cos functions
  52.  
  53. define cos_color_offset (cos(3.14 * fmod(x*y, 1) + otheta) + 1) / 2
  54. define cos_color <cos_color_offset, 1 - cos_color_offset, 0>
  55. define xyz_cos_texture
  56. texture {
  57.    special surface {
  58.       color cos_color
  59.       ambient 0.2
  60.       diffuse 0.7
  61.       specular white, 0.2
  62.       microfacet Reitz 10
  63.       }
  64.    }
  65.  
  66. // Define a texture based on moving the z component of the normal
  67. define z_ripple_normal
  68. texture {
  69.    special surface {
  70.       normal <N[0], N[1], N[2]+sin(10*x+otheta)*sin(10*z+otheta)/2>
  71.       color coral
  72.       ambient 0.2
  73.       diffuse 0.8
  74.       specular white, 0.2
  75.       microfacet Reitz 10
  76.       }
  77.    }
  78.  
  79. // Define a texture using a color wheel
  80. define xz_wheel_texture
  81. texture {
  82.    special surface {
  83.       color color_wheel(x, y, z)
  84.       ambient 0.2
  85.       diffuse 0.8
  86.       specular white, 0.2
  87.       microfacet Reitz 10
  88.       }
  89.    }
  90.  
  91. // Create spheres with special textures
  92. object {
  93.    sphere <-4, 1, 1>, 2
  94.    xyz_sin_texture { translate <-4, 1, 1> }
  95.    }
  96. object {
  97.    sphere <4, 1, 1>, 2
  98.    xyz_cos_texture { translate < 4, 1, 1> }
  99.    }
  100. object {
  101.    sphere <0, 1, 0>, 2
  102.    rippled_xy_mirror
  103.    }
  104.  
  105. // Define a ground plane with run-time textures
  106. object {
  107.    disc <0, -3.001, 0>, <0, 1, 0>, 0, 1000
  108.    texture {
  109.       checker
  110.          z_ripple_normal,
  111.          xz_wheel_texture { translate <0.5, 0, 0.5>}
  112.       scale <10, 10, 10>
  113.       }
  114.    }
  115.