home *** CD-ROM | disk | FTP | other *** search
- #ifdef RCSIDS
- static char rcsid[] = "$Id: locillum.h,v 1.3 1998/09/18 02:31:07 lg Exp $";
- #endif
-
- /*
- * locillum.h - a collection of local illumination functions.
- *
- * Author: written by Larry Gritz (gritzl@acm.org)
- *
- * $Revision: 1.3 $ $Date: 1998/09/18 02:31:07 $
- *
- */
-
-
-
-
- /*
- * LocIllumGlossy - a possible replacement for specular(), which has a
- * more uniformly bright core and a sharper falloff. It's a nice
- * specular function to use for something made of glass or liquid.
- *
- * Suggested parameter values:
- * Pt = P (surface point)
- * N = faceforward (normalize(N),I)
- * V = -normalize(I)
- * width = 1 (related to the size of the highlight, larger is bigger)
- * sharpness = .5 (1 is infinitely sharp, 0 is very dull)
- */
- color LocIllumGlossy (point Pt; normal Nf; vector V;
- float width; float sharpness)
- {
- color C = 0;
- float w = .18 * (1-sharpness);
- illuminance (Pt, Nf, PI/2) {
- extern color Cl;
- extern vector L;
- float nonspec = 0;
- float r = lightsource ("__nonspecular", nonspec);
- if (nonspec < 1) {
- vector H = normalize(normalize(L)+V);
- C += Cl * ((1-nonspec) * smoothstep (.72-w, .72+w,
- pow(max(0,Nf.H), 1/width)));
- }
- }
- return C;
- }
-
-