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

  1. // Textured ridge bumps up from a sphere
  2. // Set up the camera
  3. viewpoint {
  4.    from <0,2,-6>
  5.    at <0,0,0>
  6.    up <0,1,0>
  7.    angle 20
  8.    resolution 256, 256
  9.    }
  10.  
  11. background midnight_blue
  12. light <-10, 8, -10>
  13. light < 10, 8, -10>
  14.  
  15. include "../colors.inc"
  16.  
  17. define ridge_map1 color_map(
  18.    [0.000, 0.500, <0.000, 0.000, 0.000>, 1.000, <0.451, 0.000, 0.333>, 0.502]
  19.    [0.500, 0.983, <0.451, 0.000, 0.333>, 0.502, <1.000, 0.141, 0.141>, 0.000]
  20.    [0.983, 1.000, <1.000, 0.141, 0.141>, 0.000, <0.000, 0.000, 0.000>, 1.000])
  21.  
  22. define noisy_x1 x + 5 * dnoise(P)[0]
  23. define noisy_y1 y + 5 * dnoise(P)[1]
  24. define noisy_z1 y + 5 * dnoise(P)[2]
  25. define noisy_x2 noisy_x1 - floor(noisy_x1)
  26. define noisy_y2 noisy_y1 - floor(noisy_y1)
  27. define noisy_z2 noisy_z1 - floor(noisy_z1)
  28. define noisy_checker3_fn1 fmod((noisy_x1+noisy_y1+noisy_z1)/3, 1)
  29.  
  30. define ridge_swirl_fn fmod(noisy_x1+noisy_y1+noisy_z1, 1)
  31.  
  32. define Ridge_Swirl
  33. texture { special shiny {
  34.    color ridge_map1[ridge_swirl_fn]
  35.    normal N + (ridge_swirl_fn > 0.5 ? 2 * (dnoise(20*P) - white/2) : black)
  36.    } }
  37.  
  38. object {
  39.    sphere <0, 0, 0>, 1
  40.    Ridge_Swirl
  41.    }
  42.