Lights
Lights, just like other gops, change the graphics state, and affect
all subsequently created gprims. Gprims must have a surface shader,
in order to see the effect of the lights.
Lights can be also be turned on and off with the "illuminate" command,
which requires two arguments, the id number of the light, followed by
either the string "on" or the string "off". The id number is returned
when a light is created, so for example, to create a light, then turn
it off and back on again, we might use:
(define light-id (light "distantlight"))
(illuminate light-id "off")
(illuminate light-id "on")
"Light" requires one argument, a "type". This can be followed by
a parameter list. Parameters include; "intensity", "lightcolor", "from",
and "to", though not all of these are applicable for all light types.
(e.g. it doesn't make sense to have a "to" parameter for non-directional
lights). See The Renderman Companion and the manual for Dave for
details on the exact parameters each light can take.
Below are a few of the more commonly used light types:
Ambient Light
The simplest light type is ambient light, it
distributes light uniformly on all surfaces, regardless of position or
orientation.
This is a simple animation demonstrating the effect of ambient lighting.
The entire scene has a weak "distantlight" also,
so that the forms are visible. We will discuss "distancelights" next.
Animation:
(source code)
Distant Light
The next simplest light type is distant light. It distributes light uniformly
in one direction. This means surfaces with the same orientation receive the
same amount of light.
Animation:
(source code)
Point Light
Point lights, as their name implies, distribute light from a specific
point in space. The intensity of the light falls off with the square
of the distance from the light. There is another version of the point
light which is the same in all respects, except there is no intensity
fall off with distance. It is called "pointnofalloff".
Animation:
(source code)
Spot Light
Spot lights are like point lights except they can be aimed in a given
direction. The distribute light from a specific
spot in space. The intensity of the light falls off with the square of
the distance from the light.
Animation:
(source code)
Moving Light
Lights are also affected by the current
transformation in the graphics state. They can be moved around using
transform gops like any other object.
Animation:
(source code)
Shadows
Creating shadows is a complicated process.
The scene must actually be rendered twice, once from the point of view
of the light, then once from the point of view of the camera.
There are two lights implemented that will make shadows: the "shadowpoint"
light and the "shadowspot" light. They correspond to the "pointlight"
and the "spotlight" above.
For the example below there are two cameras, one placed at the same position
as the light, with the same fov, and the main scene camera. Each frame is
first rendered using the lightcam, then with the maincam. This example uses
the "shadowspot" which computationally much simpler than using the
"pointspot". While the shadow spot only requires you to render the scene
from one direction (the direction the spot is facing), the "pointspot"
requires SIX shadowmaps, as it casts light in all directions.
See The Renderman Companion and the manual for Dave for
details on using the "shadowpoint" light.
Animation:
(source code)
Return to AL Introduction
mrl