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_shiny.sl < prev    next >
Encoding:
Text File  |  2008-01-23  |  1.4 KB  |  42 lines

  1. /****************************************************************************
  2.  * shiny.sl -- Shiny metal surface
  3.  *
  4.  * Parameters:
  5.  *    Ka, Kd, Ks, roughness - The usual meaning
  6.  *    Kr - coefficient for mirror-like reflections of environment
  7.  *    blur - how blurry are the reflections? (0 = perfectly sharp)
  8.  *    envname, envspace, envrad - controls for using environment maps
  9.  *    rayjitter, raysamples - ray tracing controls for reflection
  10.  *    twosided - if nonzero both sides of the surface are shiny, otherwise
  11.  *        only the "outside" (where the surface normal points) will
  12.  *        spawn rays.  This can be an important optimization, especially
  13.  *        when using the "ray server."
  14.  *
  15.  ***************************************************************************
  16.  *
  17.  * Author: Larry Gritz (gritzl@acm.org).
  18.  *
  19.  * Reference:
  20.  *   _Advanced RenderMan: Creating CGI for Motion Picture_, 
  21.  *   by Anthony A. Apodaca and Larry Gritz, Morgan Kaufmann, 1999.
  22.  *
  23.  * $Revision: 1.2 $    $Date: 2006/03/08 16:01:22 $
  24.  *
  25.  ****************************************************************************/
  26.  
  27. #include "k3d_material.h"
  28.  
  29.  
  30.  
  31. surface k3d_shiny(float Ka = 1, Kd = 0.1, Ks = 1, roughness = 0.2;
  32.           float Kr = 0.8, blur = 0; DECLARE_DEFAULTED_ENVPARAMS;
  33.           float twosided = 0;)
  34. {
  35.   normal Nf = faceforward(normalize(N), I);
  36.   Ci =
  37.     MaterialShinyMetal(Nf, Cs, Ka, Kd, Ks, roughness, Kr, blur, twosided,
  38.                ENVPARAMS);
  39.   Oi = Os;
  40.   Ci *= Oi;
  41. }
  42.