A light source illuminates the objects in a scene. Light sources in mental ray are programmable and consist of a light source name, a named light shader function, and an optional origin and direction (exactly one of the two must be present). All light shaders also accept shader parameters that depend on the shader. All standard shaders require a light color parameter.
The lights available to a scene are defined outside materials and referenced by name inside materials. Only those lights which a material references will illuminate surfaces which use that material.
The shading function for light sources may be either a user written function linked at run time, or it may be one of the standard functions. There are standard shader libraries for Alias, Alias Maya, Autodesk 3D Studio MAX, Dassault CATIA, SOFTIMAGE, SolidWorks, and Wavefront compatibility, as well as generic shader libraries such as mental images' base, physics, and Lume shader libraries.
Some shaders accept a boolean parameter shadow that turns shadow casting on or off for that light source, and a floating point factor that is the shadow factor. The shadow factor controls penetration of opaque objects.
For example, the mib_light_spot shader in the base shader
library implements a spot light. It has a color parameter that
must be set to the color of the light, as three scalars for the red,
green, and blue components. It also allows a boolean shadow
parameter that enables shadows cast from this light if its value is
on, and a factor parameter that controls shadow
penetration, ranging from 0.0 for black shadows to 1.0 for
invisible shadows. The shader also accepts a boolean atten
parameter that turns distance attenuation on or off, and two scalar
parameters start and stop that specify the range over which
the attenuation falls off if atten is on. The spot light
mode requires an origin, a direction, and a spread value in the light
definition in the scene description file. The spread value in the
light definition and the cone parameter of the shader together
define the spot characteristics of the light. The cone parameter
specifies the angle of the inner solid cone and the spread statement
specifies the outer falloff cone. The spot casts a cone of light with
a softened edge where the intensity falls off to zero between the cone
and spread angles. This and most other shaders specify angles not in
degrees but in the cosine of one-half of the opening angle to improve
performance: 1.0 is an opening angle of 0 degrees (a laser beam too
narrow to see), 0.707 specifies an opening angle of approximately 90
degrees (because cos
0.707) and 0.0 specifies
an opening angle of 180 degrees.