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

  1. //
  2. // Wood texture data file by Dan Farmer
  3. //
  4.  
  5. include "..\colors.inc"
  6. include "..\texture.inc"
  7.  
  8. viewpoint {
  9.    from <-20, 15, -20>
  10.    at <-2, 5, 0>
  11.    up <0, 1, 0>
  12.    aspect 4/3
  13.    angle 35
  14.    resolution 320, 200
  15.    }
  16.  
  17. object {
  18.     sphere <0, 0, 0>, 950000
  19.     texture {
  20.         surface {
  21.             ambient gray, 1.0
  22.             diffuse gray, 0.65
  23.         }
  24.     }
  25. }
  26.  
  27. light  <0.8, 0.8, 0.8>, <-15.0, 10.0, -13.0>
  28. light  <0.6, 0.6, 0.6>, <-10.0, 30.0, 20.0>
  29.  
  30.  
  31. define light_wood <0.52, 0.37, 0.26> * 1.5
  32. define median_wood <0.42, 0.26, 0.15> * 1.5
  33. define dark_wood <0.05, 0.01, 0.005>  * 1.5
  34.  
  35. define wood_scale 2
  36. define xydist wood_scale * sqrt(x * x + y * y)
  37.  
  38. define wood_turb 0.8
  39. define Octaves 3.0
  40. define wood_fn  (sawtooth(xydist + wood_turb * noise(P,Octaves)) + 1) / 2
  41.  
  42. define wood_map
  43.    color_map(
  44.       [0.0,  0.10,  black,  black]
  45.       [0.10, 0.30,  black,  median_wood]
  46.       [0.30, 0.40,  median_wood,  dark_wood]
  47.       [0.40, 0.70,  dark_wood,  median_wood]
  48.       [0.70, 0.90,  median_wood,  median_wood]
  49.       [0.90, 1.00,  median_wood,  black]
  50.       )
  51.  
  52. define wood_texture
  53.    texture {
  54.       special surface {
  55.          color wood_map[wood_fn]
  56.          specular white, 0.5 + 0.5 * wood_fn^4
  57.          microfacet Reitz 5 + 10 * (1 - wood_fn)
  58.          ambient 0.18
  59.          diffuse 0.8
  60.          }
  61.       scale <0.2, 0.2, 1>            // make 5 "rings" per unit
  62.       translate <0, -0.25, 15>       // cosmetic adjustments
  63.       scale <2.75, 2.75, 1>          // Enlarge the whole thing
  64.       rotate <0, 90, 0>              // Align along the x axis (almost)
  65.       rotate <0, -1, 0>              // Shift slightly askew of center
  66.    }
  67.  
  68. define Abox object { box <-10, -5, -2>, <10, 5, 2> }
  69.  
  70. define Angled_Plane
  71.    object {
  72.       disc <0, 0, 0>, <-1, 0, 0>, 20
  73.       rotate <0, 0, -45>
  74.       translate <-10, 0, 0>
  75.    }
  76.  
  77.  
  78. // root_solver Ferrari
  79. // root_solver Vieta
  80. // root_solver Sturm
  81. define rez 128
  82. define Hole object { cylinder <5, 0, 2.1>, <5, 0, -2.1>, 4
  83.    //u_steps rez
  84.    //v_steps 128
  85. }
  86. define Bevel1 object { torus 4.0, 0.75, <5, 0,  2>, <0, 0, 1>
  87.    root_solver Sturm
  88.    //u_steps 128
  89.    //v_steps 128
  90. }
  91. define Bevel2 object { torus 4.0, 0.75, <5, 0, -2>, <0, 0, 1>
  92.    root_solver Sturm
  93.    //u_steps 128
  94.    //v_steps 128
  95. }
  96. define Bevels object { (Bevel1 + Bevel2) }
  97.  
  98. define Block
  99.    object {
  100.       (((Abox*Angled_Plane) -Bevels) -Hole)
  101.       bounding_box <-10, -5.5, -2>, <10, 5.5, 2>
  102.       translate <0, 5, 0>
  103. }
  104.  
  105. Block { wood_texture }
  106.