// From Pixar's Application Notes #19 with slight modifications Via // The RenderMan Shading Language Guide surface hair (float Ka = 1, Kd = .6, Ks = .35, roughness = .15; color rootcolor = color (.109, .037, .007); color tipcolor = color (.519, .325, .125); color specularcolor = (color(1) + tipcolor) / 2; float theta=0;) { vector Tu = normalize(dPdu); vector Tv = normalize(dPdv); vector T = 0.5*(Tv+Tu+(Tv-Tu)*cos(2*PI/180*theta)); vector V = -normalize(I); /* V is the view vector */ color Cspec = 0, Cdiff = 0; /* collect specular & diffuse light */ float cosang; /* Loop over Lights, catch highlights as if this was a thin cylinder */ illuminance (P) { cosang = cos (abs (acos (T.normalize(L)) - acos (-T.V))); // Assuming 'v' is 0 at the root of each hair and 1 at the tip, you // can try using it as a scale factor, ie // Cl*v*pow(cosang, 1/roughness) for Cspec and Cl*v for Cdiff Cspec += Cl*pow(cosang, 1/roughness); Cdiff += Cl; } Oi = Os; Ci = Oi * (mix(rootcolor, tipcolor, v) * (Ka*ambient() + Kd*Cdiff) + (Ks * Cspec * specularcolor)); }