### 3.7.2 The Spotlight Source

Spotlights are a very useful type of light source. They can be used to add highlights and illuminate features much as a photographer uses spots to do the same thing. To create a spotlight simply add the `spotlight` keyword to a regular point light. There are a few more parameters with spotlights than with pointlights. These are `radius`, `falloff`, `tightness` and `point_at`. The `radius` parameter is the angle of the fully illuminated cone. The `falloff` parameter is the angle of the umbra cone where the light falls off to darkness. The `tightness` is a parameter that determines the rate of the light falloff. The `point_at` parameter is just what it says, the location where the spotlight is pointing to. Let's change the light in our scene as follows:

      light_source {
        <0, 10, -3>
        color White
        spotlight
        radius 15
        falloff 20
        tightness 10
        point_at <0, 0, 0>
      }

We render this at 200x150 `-A` and see that only the objects are illuminated. The rest of the plane and the outer portions of the objects are now unlit. There is a broad falloff area but the shadows are still razor sharp. Let's try fiddling with some of these parameters to see what they do. We change the falloff value to 16 (it must always be larger than the radius value) and render again. Now the falloff is very narrow and the objects are either brightly lit or in total darkness. Now we change falloff back to 20 and change the tightness value to 100 (higher is tighter) and render again. The spotlight appears to have gotten much smaller but what has really happened is that the falloff has become so steep that the radius actually appears smaller.

We decide that a tightness value of 10 (the default) and a falloff value of 18 are best for this spotlight and we now want to put a few spots around the scene for effect. Let's place a slightly narrower blue and a red one in addition to the white one we already have:

      light_source {
        <10, 10, -1>
        color Red
        spotlight
        radius 12
        falloff 14
        tightness 10
        point_at <2, 0, 0>
      }
      light_source {
        <-12, 10, -1>
        color Blue
        spotlight
        radius 12
        falloff 14
        tightness 10
        point_at <-2, 0, 0>
      }

Rendering this we see that the scene now has a wonderfully mysterious air to it. The three spotlights all converge on the objects making them blue on one side and red on the other with enough white in the middle to provide a balance.