/* Copyrighted Pixar 1989 */ /* From the RenderMan Companion p.369 */ /* Listing 16.26 Shader mapping object-space coordinates to colors*/ /* * glow(): a shader for providing a centered "glow" in a sphere */ surface glow( float attenuation = 2 ) { #ifndef ORIGINAL /* This section was added by wave@media.mit.edu -- tal */ point NN = normalize(N); point II = normalize(I); float falloff = II.NN; /* Direct incidence has cosine closer to 1.*/ #else /* What is in the book. -- tal */ float falloff = I.N; /* Direct incidence has cosine closer to 1.*/ #endif /* ORIGINAL */ if (falloff < 0) { /* Back of sphere only */ #ifndef ORIGINAL /* This section was added by wave@media.mit.edu -- tal */ /* Normalize falloff by lengths of I and N */ falloff = falloff * falloff / (II.II * NN.NN) ; #else /* What is in the book. -- tal */ falloff = falloff * falloff / (I.I * N.N) ; #endif /* ORIGINAL */ falloff = pow(falloff, attenuation); Ci = Cs * falloff; Oi = falloff; } else Oi = 0; }