home *** CD-ROM | disk | FTP | other *** search
/ Hackers Magazine 57 / CdHackersMagazineNr57.iso / Software / Multimedia / k3d-setup-0.7.11.0.exe / share / k3d / shaders / surface / k3d_easysurface.sl < prev    next >
Encoding:
Text File  |  2008-01-23  |  474 b   |  23 lines

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