next up previous contents
Next: Surface Shaders Up: Light Source Shaders Previous: Area Light Sources   Contents


Light Sources And Shadows

Similar to the spotlight shader shown before you can define a shadowspot shader which casts shadows. The main difference is that before the final color is assigned to the global variable Cl there might be an attenuation of the light contribution because the illuminated point is in shadow. Here are the two lines (beside additional parameters for the shader) which make the difference:

...
if (shadowname != "") {
    atten *= 1-shadow(shadowname, Ps, 
                      "samples", shadownsamps,
                      "blur", shadowblur, 
                      "bias", shadowbias);
}
Cl = atten * intensity * lightcolor;
...

Notice that the source code of the shader printed in the book is slightly different from the version you can download from the companion web site:

http://www.mkp.com/renderman



Jan Walter 2004-02-09