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

  1. /****************************************************************************
  2.  * shinyplastic.sl -- Shiny plastic 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.  *    ior - index of refraction (1.5 is a good estimate for most plastics)
  9.  *    envname, envspace, envrad - controls for using environment maps
  10.  *    rayjitter, raysamples - ray tracing controls for reflection
  11.  *    twosided - if nonzero both sides of the surface are shiny, otherwise
  12.  *        only the "outside" (where the surface normal points) will
  13.  *        spawn rays.  This can be an important optimization, especially
  14.  *        when using the "ray server."
  15.  *
  16.  ***************************************************************************
  17.  *
  18.  * Author: Larry Gritz (lg@bmrt.org)
  19.  *
  20.  * $Revision: 1.1 $    $Date: 2006/02/25 20:11:54 $
  21.  *
  22.  ****************************************************************************/
  23.  
  24. #include "k3d_rayserver.h"
  25. #include "k3d_material.h"
  26.  
  27. surface k3d_shinyplastic(float Ka = 1, Kd = 0.5, Ks = .5, roughness = 0.1;
  28.              float Kr = 1, blur = 0, ior = 1.5;
  29.              DECLARE_DEFAULTED_ENVPARAMS;
  30.              float twosided = 0;
  31.   )
  32. {
  33.   normal Nf = faceforward(normalize(N), I);
  34.   Ci =
  35.     MaterialShinyPlastic(Nf, Cs, Ka, Kd, Ks, roughness, Kr, blur, ior,
  36.              twosided, ENVPARAMS);
  37.   Oi = Os;
  38.   Ci *= Oi;
  39. }
  40.