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

  1. /* shinymetal.sl - Standard metal with environment mapping for
  2.  * RenderMan Interface.
  3.  * (c) Copyright 1988, Pixar.
  4.  *
  5.  * The RenderMan (R) Interface Procedures and RIB Protocol are:
  6.  *     Copyright 1988, 1989, Pixar.  All rights reserved.
  7.  * RenderMan (R) is a registered trademark of Pixar.
  8.  */
  9.  
  10. surface k3d_shinymetal(float Ka = 1;
  11.                float Ks = 1; float Kr = 1; float roughness = .1;
  12.                string texturename = "";)
  13. {
  14.   normal Nf;
  15.   vector V, D;
  16.   color env;
  17.  
  18.   V = normalize(I);
  19.   Nf = faceforward(normalize(N), V);
  20.   D = reflect(V, Nf);
  21.   D = vtransform("world", D);
  22.  
  23.   if(texturename != "")
  24.     env = Kr * color environment(texturename, D);
  25.   else
  26.     env = 0;
  27.  
  28.   Oi = Os;
  29.   Ci = Os * Cs * (Ka * ambient() + Ks * specular(Nf, -V, roughness) + env);
  30. }
  31.