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

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