Chapter 11 Lighting and Shading

Shading a surface involves the following:

  1. Illumination--define the intensity and color of light that arrives at a point.
  2. reflection/transmission--interaction of light with surface to give color and intensity of light reflected towards viewer.
  3. atmospheric effects -- modification of light from light source to object and then from object to viewer.

Prman does all this by the use of shaders. So we have light source shaders -- point, distant, spot lights, window lights, etc. There are surface shaders, volume shaders, etc. Prman provides a set of shaders but the user can write their own shader. A shader is a procedure called to compute a value or set of values needed during rendering. There may be multiple instances of a shader, e.g., several point light sources, each with different parameters.

Environment variables

There are several environment variables that can be associated with shaders, such as the following:

RiColor (CS) - color of surface, e.g., ( .2 .2 .8) (RGB)
RiOpacity (OS) - opacity of surface with 0.0 <= os <="1.0" so os="(0" 1 1) would be transparent to red light
Ri Shading Rate(size): control the frequency of shading surface. If size =1 ==> surface is shated similar to sampling rate. The shading rate is for a given surface, while the sampling rate is for the entire scene. Usually the color of a surface changes slower than the geometry of the surface, so the shading rate might be less than the sampling rate. We might set the size >1 for a draft image and then <=1 for final image.
RiShadingInterpolation (type): Controls how often a surface is fully shaded by type:
Sometimes want to composite image and leave bare "holes" in image for new objects so use Ri mmatte( ) -- rendered without shading but blocks objects behind.

Light Source Shaders

We can create a light source by:

Ri Light Handle Ri Light Source (name, parameterlist).

We can have multiple instances of lights, each one creates a new light, The light is automatically "on" when created. We can turn it off/on by: RiIlluminate(light, onoff). Once defined a light source remains until the end of enclosing block (world or Frame).

There are some prdefined light sources as follows (in format name, parameterlist) (The default instnsities and colors are all 1.0):

A spotlight is more complex than the other light sources. The figure below shows the different parameters of the spotlight:

Similar to a pointlight, a spotlight has a position and a direction. The intensity falls off with angle such that the intensity = 1 in the direction of the spotlight (from--> to) and intensity = 0 at coneangle radians away. The fall off function F(ca) = F1 * F2, where F1= (L*A)^beamdistribution. A = from->to direction and L = light vector from surface point to spot light. So the larger the beamdistribution the faster the faster fall off. F2 = 1 from A to coneangle - conedeltaangle redians and has a smooth fall-off to 0 at coneangle radians.

Here is a set of four images that illustrate the different types of light sources:

Ambient light only

Distant light only

Point light only

Spot light only

Here is the RIB file that produced these images.

Surface Shaders

Surface shaders determine the color of light reflected from a surface. Generaly we use the incoming light and the surface properties. In general I reflected( )= I incident( ) * reflectivity( ). We usually only sample at 3 colors's (R,G,B) although could change by, RiColorSource (N,n RGB, RGBn) which sets RiColor to [N] rather than [3].

Predefined surface shaders boat reflected color as (ombient, deflse, & speuellor reflections) Ombient --> constant deffuse CI=CL * max( ,N*L) | | reflected light incident light Specular reflection --> CI = CL * (N*H) H=y2 way between L, I median view Surface shaders are are chosen by RiSurface(name, parameterlist). There are several standard surface shaders as follows:

For the above the specular intensity is given by (N*H) 1/roughness, i.e. roughness = 1/(Phong n value)

Volume - Atmosphere Shaders

Volume shaders affect light passing through a volume. A special case is atmosphere shaders. There are two standard atmosphere shaders: