/* @(#)texmap.sl 1.4 (Pixar - RenderMan Division) 5/7/90 */ /*-______________________________________________________________________ ** ** Copyright (c) 1989 PIXAR. All rights reserved. This program or ** documentation contains proprietary confidential information and trade ** secrets of PIXAR. Reverse engineering of object code is prohibited. ** Use of copyright notice is precautionary and does not imply ** publication. ** ** RESTRICTED RIGHTS NOTICE ** ** Use, duplication, or disclosure by the Government is subject to the ** following restrictions: For civilian agencies, subparagraphs (a) through ** (d) of the Commercial Computer Software--Restricted Rights clause at ** 52.227-19 of the FAR; and, for units of the Department of Defense, DoD ** Supplement to the FAR, clause 52.227-7013 (c)(1)(ii), Rights in ** Technical Data and Computer Software. ** ** Pixar ** 3240 Kerner Blvd. ** San Rafael, CA 94901 ** ** ______________________________________________________________________ */ /*---------------------------------------------------------------------------- * texmap - texture-map shader * * Puts a B/W texture map onto a surface. * texname - the name of the texture file * maporigin - the center of the projection. * Ka, Kd, Ks, roughness, specularcolor - the usual meaning *---------------------------------------------------------------------------*/ surface bwtexmap(string texname = ""; float Ka=1, Kd=1, Ks=0, roughness=.25; color specularcolor = 1) { uniform float ssize, tsize; varying vector Nf, NI; varying point PP,O,X,Y,Z,NN; varying color ctx; Nf = faceforward( normalize(N), I); if (texname == "") ctx = 1; else ctx = float texture(texname [0]); Ci = (Ka*ambient() + Kd*diffuse(Nf)) * ctx; if (Ks != 0.0) { NI = normalize(-I); Ci += Ks*specularcolor*specular(Nf,NI,roughness); } Oi = Os; Ci = Ci * Oi; }