next up previous contents
Next: Spot Light Sources Up: Light Source Shaders Previous: Distant Light Sources   Contents


Point Light Sources

A point light source is the converse of a distant light. It radiates light in all directions, but from a single location.

light pointlight (
    float intensity = 1;
    color lightcolor = 1;
    point from = point "shader" (0,0,0))
{
    illuminate (from)
        Cl = intensity * lightcolor / (L.L);
}

Within illuminate46 L is a vector from the position of the light source to the surface point being illuminated. The dot product implements the square-law falloff of light intensity with distance from the source.



Jan Walter 2004-02-09