home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0090 - 0099 / ibm0090-0099 / ibm0099.tar / ibm0099 / TOPASI-1.ZIP / RMAN / CGREFMAP.SL < prev    next >
Encoding:
Text File  |  1991-01-22  |  699 b   |  26 lines

  1. /* @(#)cgrefmap.sl    1.2    (CryslatGraphics Inc.)    11/12/90 */
  2. /* Reflection Map shader for CrystalGraphics RIB files */
  3. surface
  4. cgrefmap (float Ka=1, Ks=1, Kr = 1, Kd = 1, roughness=.1;
  5.         string texturename = "";)
  6. {
  7.     point Nf, D, V;
  8.     color Cr,Cx,Cy;
  9.     color Cf = color(0.9, 0.89, 0.785);
  10.         /* Cf is a color scale factor to darken maps */ 
  11.  
  12.     Nf = faceforward(normalize(N), I) ;
  13.     V = normalize(-I);
  14.  
  15.     if (texturename != "") {
  16.     Cr = Kr * Cf * color texture(texturename);
  17.     } else {
  18.     Cr = Cs;
  19.     }
  20.  
  21.     Oi = Os;
  22.     Cy = Os * Cs * (Ka*ambient() + Kd * diffuse(Nf));
  23.     Cx = Cy + (1 - Cy) * Ks * specular(Nf,V,roughness);
  24.     Ci = Cx + (1 - Cx) * Cr;
  25. }
  26.