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