home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 August / chip_08_2000.iso / aktualnosci / shareware / Rhinoceros / rh11eval_20000320.exe / %MAINDIR% / RIB / rh_paintedplastic.sl < prev    next >
Encoding:
Text File  |  2000-06-08  |  1.2 KB  |  44 lines

  1. /* Custom Rhino painted plastic shader based on standard painted plastic shader.
  2.  * A custom name is used to make sure Rhino always finds it.
  3.  *
  4.  *
  5.  *
  6.  *
  7.  * paintedplastic.sl - Standard texture map surface for RenderMan Interface.
  8.  * (c) Copyright 1988, Pixar.
  9.  *
  10.  * The RenderMan (R) Interface Procedures and RIB Protocol are:
  11.  *     Copyright 1988, 1989, Pixar.  All rights reserved.
  12.  * RenderMan (R) is a registered trademark of Pixar.
  13.  *
  14.  * DESCRIPTION:
  15.  *    Apply a texture map to a plastic surface, indexing the texture
  16.  *    by the s,t parameters of the surface.
  17.  *
  18.  * PARAMETERS:
  19.  *    Ka, Kd, Ks, roughness, specularcolor - the usual meaning.
  20.  *    texturename - the name of the texture file.
  21.  *
  22.  */
  23.  
  24.  
  25. surface
  26. rh_paintedplastic ( float Ka = 1, Kd = .5, Ks = .5, roughness = .1;
  27.          color specularcolor = 1;
  28.          string texturename = ""; )
  29. {
  30.   normal Nf;
  31.   vector V;
  32.   color Ct;
  33.  
  34.   if (texturename != "")
  35.        Ct = color texture (texturename);
  36.   else Ct = 1;
  37.  
  38.   Nf = faceforward (normalize(N),I);
  39.   V = -normalize(I);
  40.   Oi = Os;
  41.   Ci = Os * ( Cs * Ct * (Ka*ambient() + Kd*diffuse(Nf)) +
  42.           specularcolor * Ks*specular(Nf,V,roughness));
  43. }
  44.