Section 4.6.6
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 you want your light source to be a visible shape, you can use the looks_like keyword. You can specify that your light source can look like any object you choose. When you use looks_like , 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 you 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 I 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 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 } }

Note that we have placed this area light in the x-y-plane instead of the x-z-plane. Note also 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. More interesting results might therefore be obtained in this case by using halos (see section "Halos" ).


Section 4.6.7
Light Source Specials


Section 4.6.7.1
Using Shadowless Lights

Light sources can be assigned the shadowless keyword and no shadows will be cast due to its presence in a scene. What good is that you may ask. Sometimes, scenes are difficult to illuminate properly using the lights you have chosen to illuminate your objects. It is impractical and unrealisitic to apply a higher ambient value to the texture of every object in the scene. So instead, you would place a couple of fill lights around the scene. Fill lights are simply dimmer lights with the shadowless keyword that act to boost the illumination of other areas of the scene that may not be lit well. Let's try using one in our scene.

Remember the three colored area spotlights? Go back now and uncomment them and comment out any other lights you have made. Now add the following:

%%%

%%% light_source { %%% <0, 20, 0> %%% color Gray75 %%% shadowless %%% } %%%

This is a fairly dim ( Gray75 ) light 20 units over the center of the scene. It will give a dim illumination to all objects including the plane in the background. Render it and see.


Section 4.6.7.2
Using Light Fading

If it is realism we want, it is not realistic for the plane to be evenly illuminated off into the distance. In real life, light gets scattered as it travels so it diminishes its ability to illuminate objects the farther it gets from its source. To simulate this, POV-Ray allows you to use two keywords: fade_distance , which specifies the distance at which full illumination is achieved; and fade_power , an exponential value which determines the actual rate of attenuation. Let's apply these keywords to our fill light.

First, make the fill light a little brighter by changing Gray75 to Gray50 . Now change that fill light as follows:

light_source { <0, 20, 0> color Gray50 fade_distance 5 fade_power 1 shadowless }

This means that the full value of the fill light will be achieved at a distance of 5 units away from the light source. The fade_power of 1 means that the falloff will be linear (the light falls of at a constant rate). Render this to see the result.

That definitely worked! Now let's try a fade_power of 2 and a fade_distance of 10. Again, this works well. The falloff is much sharper with a fade_power of 2 so we had ot raise the fade_distance to 10.


Section 4.6.7.3
Light Sources and Atmosphere

By definition more than default, light sources are affected by atmosphere, i.e. their light is scattered by the atmosphere. This can be turned off by adding atmosphere off to the light source block. The light emitted by a light source can also be attenuated by the atmosphere (and also fog), that is it will be diminished as it travells through it, by adding atmospheric_attenuation on . The falloff is exponential and dependes on the distance parameter of the atmosphere (or fog). You should note that this featuer only affects light coming directly from the light source. Reflected and refracted light is ignored.

Let's experiment with these keywords. First we must add an atmosphere to our scene:

#include "atmos.inc" atmosphere { Atmosphere2 }

Then, so the trace will not take as long and the effect will be easier to see, comment out the three lines that turn each of the three spotlights into area lights:

//area_light <1, 0, 0>, <0, 0, 1>, 2, 2 //adaptive 1 //jitter

Tracing the scene at 200x150 -A we see that indeed the spotlights are visible. We can see where the blue and red spots cross each other and where the white overhead light shines down through the center of the scene. We also notice that the spotlights appear to diminish in their intensity as the light descends from the light source to the objects. The red light is all but gone in the lower left part of the scene and the blue light all but gone in the lower right. This is due to the atmospheric attenuation and lends a further realism to the scene. The atmosphere-lightsource interaction gives our scene a smoky, mysterious appearance, but the trace took a long time. Make those spotlights area lights and it will take even longer. This is an inevitable trade-off - tracing speed for image quality.


Section 4.7
Simple Texture Options

The pictures rendered so far where somewhat boring regarding the appearance of the objects. Let's add some fancy features to the texture.

Section 4.7.1
Surface Finishes

One of the main features of a ray-tracer is its ability to do interesting things with surface finishes such as highlights and reflection. Let's add a nice little phong highlight (shiny spot) to the sphere. To do this you need a finish parameter. Change the definition of the sphere to this:

sphere { <0, 1, 2>, 2 texture { pigment { color Yellow } // Yellow is pre-defined in COLORS.INC finish { phong 1 } } }

Now render this the same way you did before. The phong keyword adds a highlight the same color of the light shining on the object. It adds a lot of credibility to the picture and makes the object look smooth and shiny. Lower values of phong will make the highlight less bright (values should be between 0 and 1).


Section 4.7.2
Adding Bumpiness

The highlight you've added illustrates how much of our perception depends on the reflective properties of an object. Ray-tracing can exploit this by playing tricks on our perception to make us see complex details that aren't really there.

Suppose you wanted a very bumpy surface on the object. It would be very difficult to mathematically model lots of bumps. We can however simulate the way bumps look by altering the way light reflects off of the surface. Reflection calculations depend on a vector called a surface normal vector. This is a vector which points away from the surface and is perpendicular to it. By artificially modifying (or perturbing) this normal vector you can simulate bumps. Change the scene to read as follows and render it:

sphere { <0, 1, 2>, 2 texture { pigment { color Yellow } normal { bumps 0.4 scale 0.2 } finish { phong 1} } }

This tells POV-Ray to use a bump pattern to modify the surface normal. The value 0.4 controls the apparent depth of the bumps. Usually the bumps are about 1 unit wide which doesn't work very well with a sphere of radius 2. The scale makes the bumps 1/5th as wide but does not affect their depth.


Next Section
Table Of Contents