Previous:Using Shadowless Lights Main Index Next:Using Light Fading

#### Assigning an Object to a Light Source

Light sources are invisible. They are just a location where the light appears to be coming from. They have no true size or shape. If we want our light source to be a visible shape, we can use the `looks_like` keyword. We can specify that our light source can look like any object we choose. When we use `looks_like`, then `no_shadow` is applied to the object automatically. This is done so that the object will not block any illumination from the light source. If we want some blocking to occur (as in a lampshade), it is better to simply use a union to do the same thing. Let's add such an object to our scene. Here is a light bulb we have made just for this purpose:

      #declare Lightbulb = union {

        merge {

          sphere { <0,0,0>,1 }

          cylinder { <0,0,1>, <0,0,0>, 1

            scale <0.35, 0.35, 1.0>

            translate  0.5*z

          }

          texture {

            pigment {color rgb <1, 1, 1>}

            finish {ambient .8 diffuse .6}

          }

        }

        cylinder { <0,0,1>, <0,0,0>, 1

          scale <0.4, 0.4, 0.5>

          texture { Brass_Texture }

          translate  1.5*z

        }

        rotate -90*x

        scale .5

      }

Now we add the light source:

      light_source {

        <0, 2, 0>

        color White

        looks_like { Lightbulb }

      }

Rendering this we see that a fairly believable light bulb now illuminates the scene. However, if we do not specify a high ambient value, the light bulb is not lit by the light source. On the plus side, all of the shadows fall away from the light bulb, just as they would in a real situation. The shadows are sharp, so let's make our bulb an area light:

      light_source {

        <0, 2, 0>

        color White

        area_light <1, 0, 0>, <0, 1, 0>, 2, 2

        adaptive 1

        jitter

        looks_like { Lightbulb }

      }

We note that we have placed this area light in the x-y-plane instead of the x-z-plane. We also note that the actual appearance of the light bulb is not affected in any way by the light source. The bulb must be illuminated by some other light source or by, as in this case, a high ambient value.

Previous:Using Shadowless Lights Main Index Next:Using Light Fading