home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 1995 January / pcw-0195.iso / polyray / dat / colors.inc next >
Text File  |  1994-12-31  |  6KB  |  156 lines

  1. // define surface characteristics this file includes simple matte and
  2. // reflective surface characteristics for some common colors.
  3. // Polyray input file - Alexander Enzmann
  4.  
  5. // We only need to define these things on the very first frame.
  6. if (frame == start_frame) {
  7. // First define some standard surface characteristics, matte, shiny (plastic),
  8. // reflective.
  9. static define matte
  10. surface {
  11.    ambient 0.1
  12.    diffuse 0.7
  13.    }
  14.  
  15. static define shiny
  16. surface {
  17.    ambient 0.1
  18.    diffuse 0.6
  19.    specular white, 0.6
  20.    microfacet Phong 7
  21.    }
  22.  
  23. static define reflective
  24. surface {
  25.    ambient 0.1
  26.    diffuse 0.5
  27.    specular white, 0.5
  28.    microfacet Phong 7
  29.    reflection white, 0.5
  30.    }
  31.  
  32. static define metallic
  33. surface {
  34.    ambient 0.1
  35.    diffuse 0.5
  36.    specular 0.6
  37.    microfacet Phong 5
  38.    reflection white, 0.25
  39.    }
  40.  
  41. // Now build textures using different colors for the surfaces above
  42.  
  43. // First the matte colors.  Diffuse reflections only, no shiny spot
  44. static define matte_white texture { matte { color white } }
  45. static define matte_grey texture { matte { color grey } }
  46. static define matte_black texture { matte { color dark_slate_gray } }
  47. static define matte_red texture { matte { color red } }
  48. static define matte_blue texture { matte { color blue } }
  49. static define matte_green texture { matte { color green } }
  50. static define matte_cyan texture { matte { color cyan } }
  51. static define matte_yellow texture { matte { color yellow } }
  52. static define matte_magenta texture { matte { color magenta } }
  53. static define matte_orange texture { matte { color orange } }
  54. static define matte_aquamarine texture { matte { color aquamarine } }
  55. static define matte_brown texture { matte { color brown } }
  56.  
  57. // Now the standard plastic coloration, diffuse color plus shiny white spot
  58. static define shiny_red texture { shiny { color red } }
  59. static define shiny_green texture { shiny { color green } }
  60. static define shiny_blue texture { shiny { color blue } }
  61. static define shiny_cyan texture { shiny { color cyan } }
  62. static define shiny_yellow texture { shiny { color yellow } }
  63. static define shiny_magenta texture { shiny { color magenta } }
  64. static define shiny_orange texture { shiny { color orange } }
  65. static define shiny_coral texture { shiny { color coral } }
  66. static define steely_blue texture { shiny { color steel_blue } }
  67.  
  68. // A set of surfaces that combine color with reflectivity
  69. static define reflective_white texture { reflective { color white } }
  70. static define reflective_grey texture { reflective { color grey } }
  71. static define reflective_red texture { reflective { color red } }
  72. static define reflective_blue texture { reflective { color blue } }
  73. static define reflective_green texture { reflective { color green } }
  74. static define reflective_cyan texture { reflective { color cyan } }
  75. static define reflective_yellow texture { reflective { color yellow } }
  76. static define reflective_magenta texture { reflective { color magenta } }
  77. static define reflective_orange texture { reflective { color orange } }
  78. static define reflective_coral texture { reflective { color coral } }
  79. static define reflective_brown texture { metallic { color brown } }
  80. static define reflective_tan texture { metallic { color tan } }
  81. static define reflective_gold texture { metallic { color coral } }
  82.  
  83. // And now some specific colors
  84. static define glass
  85. texture {
  86.    surface {
  87.       ambient 0
  88.       diffuse 0
  89.       specular 0.2
  90.       reflection white, 0.1
  91.       transmission white, 1, 1.5
  92.       }
  93.    }
  94.  
  95. static define mirror
  96. texture {
  97.    surface {
  98.       ambient white, 0.1
  99.       diffuse white, 0.2
  100.       specular 0
  101.       reflection white, 1
  102.       }
  103.    }
  104.  
  105. // Now we define some color map lookup functions that provide the ability
  106. // to mimic the predefined texture functions in other raytracers.  Most of
  107. // these would be modified in some way, perhaps to add more or less turbulence
  108. // to one of the variables, or perhaps to perform scaling in one or more
  109. // direction.  The look of a texture that uses one of these functions will
  110. // depend on how much it is scaled and what the color map looks like
  111. static define agate_fn ((sin(6.2832*(1.1*z+2.6*noise(P,<2.8,0.5,4>)))+1)/2)^0.77
  112. static define marble_fn sawtooth(x + 2*noise(P, 4))
  113. static define granite_fn noise(7*P, 5)
  114. static define wood_fn sawtooth(sqrt(x*x+y*y))
  115. static define odd_wood1
  116.    sawtooth(|<x+sin(x+dnoise(P,3)[0]), y+sin(y+dnoise(P,3)[1]), 0>|)
  117. static define noisy_wood_fn
  118.    sawtooth(|<x+0.05*sin(6.28*(x+2*dnoise(P,3)[0])),
  119.           y+0.05*sin(6.28*(y+2*dnoise(P,3)[1])), 0>|)
  120. static define bozo_fn noise(P, 1)
  121. static define leopard_fn ((sin(x)+sin(y)+sin(z))/3)^2
  122. static define onion_fn fmod(|P|, 1)
  123. static define noisy_onion_fn fmod(|P|+noise(P, 3), 1)
  124. static define checker_fn |fmod(floor(x)+floor(y)+floor(z), 2)|
  125. static define checker3_fn |fmod(floor(x)+floor(y)+floor(z), 3)|
  126. static define pi 3.1415926535897932384626
  127. static define radial_fn (1 + atan2(x, z)/pi)/2
  128.  
  129. // Some standard sorts of color maps to use with the functions above (or
  130. // modifications thereof).
  131. static define white_marble_map
  132.    color_map([0, 0.8, white, 0.5*white]
  133.          [0.8, 1, 0.5*white, 0.2*white])
  134. static define red_marble_map
  135.    color_map([0, 0.8, <1, 0.8, 0.8>, <1, 0.4, 0.4>]
  136.          [0.8, 1, <1, 0.4, 0.4>, <1, 0.1, 0.1>])
  137. static define jade_color_map
  138.    color_map([0, 0.8, <1, 0.6, 0.1>, <0, 0.3, 0>]
  139.          [0.8, 1, <0.1, 0.5, 0.1>, <0, 0, 0.3>])
  140. static define sky_color_map
  141.    color_map([0, 0.5, <0.2, 0.2, 0.5>, <0.2, 0.2, 0.5>]
  142.          [0.5, 0.6, <0.2, 0.2, 0.5>, 0.75*white]
  143.          [0.6, 1, 0.75*white, 0.25*white])
  144. static define light_wood <0.6, 0.24, 0.1>
  145. static define median_wood <0.3, 0.12, 0.03>
  146. static define dark_wood <0.05, 0.01, 0.005>
  147. static define wood_map1
  148.    color_map([0.0, 0.2, light_wood, light_wood]
  149.          [0.2, 0.3, light_wood, median_wood]
  150.          [0.3, 0.4, median_wood, light_wood]
  151.          [0.4, 0.7, light_wood, light_wood]
  152.          [0.7, 0.8, light_wood, median_wood]
  153.          [0.8, 0.9, median_wood, light_wood]
  154.          [0.9, 1.0, light_wood, dark_wood])
  155. } // End of if surrounding color defininitions
  156.