home *** CD-ROM | disk | FTP | other *** search
/ Stone Design / Stone Design.iso / Stone_Friends / Wave / WavesWorld / Source / Shaders / RCShaders / RCEasySurface.sl < prev    next >
Encoding:
Text File  |  1995-03-22  |  401 b   |  20 lines

  1. /* Listing 16.22  Surface shader for use without a light source*/
  2. /*
  3.  * easysurface(): orientation-sensitive surface shading without a light source
  4.  */
  5. surface
  6. RCEasySurface(
  7.     float    Kd    = .8, 
  8.         Ka    = .2, 
  9.         falloff    = 2.0 )
  10. {
  11.     float diffuse ;
  12.     point II = normalize(I);
  13.     point NN = normalize(N);
  14.  
  15.     diffuse = II.NN / (II.II * NN.NN);
  16.     diffuse = pow(diffuse, falloff);
  17.  
  18.     Ci = Cs * (Ka + Kd * diffuse ) ;
  19. }
  20.