/* * ashshir.sl * Simple surface using Ashikmin-Shirley BRDF * Peter Stuart * $Id: ashshir.sl,v 1.4 2003/05/05 05:22:41 ophi Exp $ * description: Ashikmin and Shirley BRDF lighting model as described * in "An Anisotropic Phong Light Reflection Model." Most of the work * is done in ashShirModel.h by two functions - one for dealing with * direct lighting, and the other for dealing with environment lighting. * * ---- surface parameters ---------- * rd: diffuse reflectance * rs: specular reflectance * nu: specular exponent along xdir * nv: specular exponent perpendicular to xdir * refl: amount of reflection to use * envname: name of environment map to use. If this is "" the shader will * try to raytrace the environment if there are samples (envsamp > 0) * envsamp: number of samples to use when sampling the environment */ #include "ashshirModel.h" surface ashshir (float rd = 0.5, rs = 0.5; float nu = 10, nv = 10; float refl = 0.1; uniform string envname=""; uniform float envsamp = 1;) { normal Nf = normalize(faceforward(N,I)); vector V = normalize(-I); vector xdir = normalize(dPdu); // contribution from light sources Ci = LocIllumAshShir(Nf, V, xdir, rd, rs, nu, nv); // contribution from environment if (envsamp > 0) Ci += refl*EnvIllumAshShir(Nf, V, xdir, rd, rs, nu, nv, envsamp, envname); Ci *= Cs; }