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 (at least one of the two must be present), plus various light-specific parameters such as shadowmap and photon information. A light profile may also be among the light-specific parameters. Light shaders accept shader parameters that depend on the shader.
The lights available in a
scene are defined outside materials.
They may be attached to scene
entities like object instances, or directly referenced inside
materials. Many existing material shaders have a parameter of type
"light array"
that allows referencing a
list of light instances by name. The material shader then applies
the illumination from
these lights to the shaded surface, no matter to which object the
shader is attached to. To implement light-object relations
independent of the actual material the shaders can also obtain a
list of lights associated with the object instance in the scene
description (see Light
Lists).
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 Autodesk Maya and 3ds Max, Dassault Systèmes CATIA, Avid/Softimage XSI, 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. The computation of shadows is a responsibility of light shaders in mental ray; in order to compute transparent shadows this may involve the cooperation of shadow shaders attached to semi-transparent shadow-casting 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(90⁄2) ≈ 0.707) and 0.0 specifies an opening angle of 180 degrees.
Copyright © 1986-2008 by mental images GmbH