1.7 Light Sources
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 is one standard shader for SOFTIMAGE compatibility, and one for Wavefront compatibility. The shading functions for all SOFTIMAGE 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 mi soft light shader has a mode parameter that selects an infinite (directional) light (mode 0), a point light (mode 1), or a spot light (mode 2). The infinite shader is a directional light source requiring a direction in the input file. The shading function requires only the shadow and factor parameters. A point light source requires an origin in the input file. The shading function accepts, in addition to the color, shadow, and factor parameters, a boolean atten that turns distance attenuation on or off, and two scalar parameters start and end that specify the range over which the attenuation falls off if atten is true. The spot light mode requires only an origin in the input file.
The spot direction is considered directional attenuation, and is given as a user parameter. The shading function takes the same parameters as the point light mode, and two cone angles cone and spread that specify the angle of the inner solid cone and the outer falloff cone, respectively. The spot casts a cone of light with a softened edge where the intensity falls off to zero between the cone and spread angles. The mi wave light shader accepts color and a dir (direction) arguments. Shadow casting cannot be turned on and off on a per-light-source basis with Wavefront light sources, and the shading function accepts no shadow factor. There are two types of attenuation, distance and angle.
Distance attenuation is turned on by either one of the two boolean flags dist linear or dist inverse. In the linear case, the fading range is controlled by dist start and dist end; in the inverse-power case, the attenuation is proportional to the distance from the illuminated point raised to the dist power argument. Wavefront angle attenuation is turned on by either one of the two boolean flags angle linear or angle cosine. In the linear case, the light falls off between the angles specified by the angle inner and angle outer arguments; in the cosine case, the light falls off proportionally to the cosine raised to the angle power argument. Angle attenuation implements spotlights. The spot light direction is the illumination direction argument, dir.
No comments:
Post a Comment