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

  1. surface k3d_environment_plastic(
  2.     float Ka = 1.0;
  3.     float Kd = 0.5;
  4.     float Ks = 0.5;
  5.     float roughness = 0.1;
  6.     float Kr = 1.0;
  7.     string environment_map = "";
  8.     float blur = 0.0;
  9.     )
  10. {
  11.     normal Nf = faceforward(normalize(N), I);
  12.     vector R = normalize(reflect(I, N));
  13.     color reflection = color environment(environment_map, R, "blur", blur);
  14.     
  15.     Oi = Os;
  16.  
  17.     Ci = Cs * (Ka * ambient() + Kd * diffuse(Nf));
  18.     Ci += Kr * reflection;
  19.     Ci += Ks * specular(Nf, -normalize(I), roughness);
  20.     Ci *= Os;
  21. }
  22.  
  23.