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

  1. start_frame 0
  2. end_frame 35
  3.  
  4. define t0 0
  5. define t1 end_frame + 1
  6. define increment frame / (t1 - t0)
  7.  
  8. // Set up the camera
  9. viewpoint {
  10.    from <0,5,-8>
  11.    at <0,0,0>
  12.    up <0,1,0>
  13.    angle 40
  14.    resolution 200, 200
  15.    }
  16.  
  17. background <0, 0, 0>
  18. light <-10, 20, -20>
  19. include "../../colors.inc"
  20.  
  21. define Grnt0a_map
  22.       color_map(
  23.      [0.000, 0.153, <0.729, 0.502, 0.451>, 0.306,
  24.             <0.769, 0.686, 0.592>, 0.792]
  25.      [0.153, 0.398, <0.769, 0.686, 0.592>,  0.792,
  26.             <0.843, 0.753, 0.718>,  0.396]
  27.      [0.398, 0.559, <0.843, 0.753, 0.718>,  0.396,
  28.             <0.780, 0.667, 0.561>,  0.976]
  29.      [0.559, 0.729, <0.780, 0.667, 0.561>,  0.976,
  30.             <0.741, 0.659, 0.576>,  0.820]
  31.      [0.729, 1.001, <0.741, 0.659, 0.576>, 0.820,
  32.             <0.729, 0.502, 0.451>,  0.306])
  33. define Grnt23_map
  34.       color_map(
  35.      [0.000, 0.178, <0.831, 0.631, 0.569>, <0.925, 0.831, 0.714>]
  36.      [0.178, 0.356, <0.925, 0.831, 0.714>, <0.871, 0.702, 0.659>]
  37.      [0.356, 0.525, <0.871, 0.702, 0.659>, <0.831, 0.631, 0.569>]
  38.      [0.525, 0.729, <0.831, 0.631, 0.569>, <0.937, 0.882, 0.820>]
  39.      [0.729, 1.001, <0.937, 0.882, 0.820>, <0.831, 0.631, 0.569>])
  40. define granite_fn_05 noise(8 * (P + 1.0 * dnoise(P, 1)), 5)
  41. define granite_fn_06 noise(8 * (P + 1.2 * dnoise(P, 1)), 5)
  42. define Grnt0a Grnt0a_map[granite_fn_06]
  43. define Grnt23 Grnt23_map[granite_fn_05]
  44.  
  45. define Stone12
  46. texture {
  47.    layered
  48.       texture { special shiny { color Grnt0a }
  49.             scale <1, 3, 2> rotate <0, 0, -30> },
  50.       texture { special shiny { color Grnt23 }
  51.             scale <1, 5, 1> rotate <0, 0, 50> }
  52.    }
  53.  
  54. define pi 3.1415926535897932384626
  55. define two_pi 2 * pi
  56.  
  57. // Convert u-v coordinates on a sphere into angles
  58. define theta u * two_pi
  59. define phi (v - 0.5) * pi
  60.  
  61.  
  62. define legendre_sphere
  63. object {
  64.    sphere <0, 0, 0>, 2
  65.    uv_steps 128, 64
  66.    displace N * 0.01 *
  67.         legendre(4, 2, cos(theta + increment * two_pi)) *
  68.         legendre(3, 2, cos(2*phi + increment * two_pi))
  69.    Stone12
  70.    }
  71. legendre_sphere
  72.