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

  1. include "../colors.inc"
  2. include "../texture.inc"
  3.  
  4. viewpoint {
  5.   from <0,0,-8>
  6.   at <0,0,0>
  7.   up <0,1,0>
  8.   angle 35
  9.   resolution 320, 240
  10.   aspect 4/3
  11.   }
  12.  
  13. background midnight_blue
  14. light 0.8*white, <-10, 10, -30>
  15. light 0.8*white, < 10, 10, -10>
  16.  
  17. // who knows what these constants are good for.  maybe something.
  18.  
  19. define barkv 1
  20. define rough 1
  21. define u_scale 64
  22. define v_scale 15
  23. define two_pi 2 * 3.14159265
  24. define bark_pos <u_scale*sawtooth(u),0,v_scale*v>
  25. define bark_texture
  26. texture {
  27.   special shiny {
  28.      color tan
  29.      normal N + rough*(dnoise(bark_pos,3)-<0.5,0.5,0.5>)
  30.      }
  31.   }
  32.  
  33. define light_wood <0.6, 0.24, 0.1>
  34. define median_wood <0.3, 0.12, 0.03>
  35. define dark_wood <0.05, 0.01, 0.005>
  36. define wood_fn0
  37.    sawtooth(|<x+0.05*sin(6.28*(x+4*dnoise(P)[0])),
  38.           y+0.05*sin(6.28*(y+4*dnoise(P)[1])), 0>|)
  39. define light_wood_texture
  40. texture {
  41.    special shiny {
  42.       color color_map([0, 0.8, light_wood, light_wood]
  43.               [0.8, 1, median_wood, median_wood])[wood_fn0]
  44.       }
  45.    rotate <90, 0, 0>
  46.    scale <0.1, 0.1, 0.1>
  47.    }
  48.  
  49. define bark
  50. object { cone <0,-4,0>, 1, <0,4,0>, 1 bark_texture }
  51. define cutting_sphere
  52. object { box <-1, -1, -1>, <1, 1, 1> light_wood_texture }
  53.  
  54. object {
  55.    (bark - cutting_sphere { rotate <0, 90, 0> translate <0, -1, -1.2> })
  56.    * object { disc <0, 1.5, 0>, <0, 1, -2>, 3 light_wood_texture }
  57.    * object { disc <0, -3.5, 0>, <0, -1, 0>, 1 light_wood_texture }
  58.    rotate <35, -30, 0>
  59.    translate <0, 1, 0>
  60.    }
  61.