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_plastic2.sl < prev    next >
Encoding:
Text File  |  2008-01-23  |  705 b   |  26 lines

  1. /* I took wave's lead and renamed plastic to DPPlastic.sl -- tal@SpamSucks_cs.caltech.edu */
  2.  
  3. /* 
  4.  * plastic.sl
  5.  *
  6.  * AUTHOR: Darwyn Peachy
  7.  *
  8.  * REFERENCES:
  9.  *    _Texturing and Modeling: A Procedural Approach_, by David S. Ebert, ed.,
  10.  *    F. Kenton Musgrave, Darwyn Peachey, Ken Perlin, and Steven Worley.
  11.  *    Academic Press, 1994.  ISBN 0-12-228760-6.
  12.  */
  13.  
  14. surface
  15. k3d_plastic2(float Ka = 1, Kd = 0.5, Ks = 0.5;
  16.         float roughness = 0.1;
  17.         color specularcolor = color (1,1,1))
  18. {
  19.     point Nf = faceforward(normalize(N), I);
  20.     point V = normalize(-I);
  21.  
  22.     Oi = Os;
  23.     Ci = Os * (Cs * (Ka * ambient() + Kd * diffuse(Nf))
  24.          + specularcolor * Ks * specular(Nf, V, roughness));
  25. }
  26.