Illumination

Lambert

Perform Lambertian illumination, given ambient and diffuse RGB colors (alpha is ignored), and a light list.

mib_illum_lambert
    color "mib_illum_lambert" (
        color           "ambience",
        color           "ambient",
        color           "diffuse",
        integer         "mode",
        array light     "lights")
ambience
is a multiplier for the ambient color. The idea is that ambient and diffuse color can be derived from the same subshader result (a texture mapper, for example) and the ambient brightness can be reduced to avoid losing the effect of illumination.
ambient
is a constant color offset.
diffuse
is added to the result for each light, after multiplication with the color returned by the light and a weight based on the dot product of the incident ray direction and the light direction.
mode
controls which lights to use, see light lists.
lights
is a list of light instances used for light lists.

Phong

Perform Phong illumination, given ambient, diffuse, and specular RGB colors, a specular exponent, and a light list.

mib_illum_phong
    color "mib_illum_phong" (
        color           "ambience",
        color           "ambient",
        color           "diffuse",
        color           "specular",
        scalar          "exponent",
        integer         "mode",
        array light     "lights")
ambience
is a multiplier for the ambient color. The idea is that ambient and diffuse color can be derived from the same subshader result (a texture mapper, for example) and the ambient brightness can be reduced to avoid losing the effect of illumination.
ambient
is a constant color offset.
diffuse
is added to the result for each light, after multiplication with the color returned by the light and a weight based on the dot product of the incident ray direction and the light direction.
specular
provides the color of specular highlights.
exponent
controls the width of the specular highlight. Smaller values increase the size.
mode
controls which lights to use, see light lists.
lights
is a list of light instances used for light lists.

Ward

Perform Ward illumination, given ambient, diffuse, and glossy RGB colors, two shinyness parameters, two direction vectors, and a light list.

mib_illum_ward
    color "mib_illum_ward" (
        color           "ambience",
        color           "ambient",
        color           "diffuse",
        color           "glossy",
        scalar          "shiny_u",
        scalar          "shiny_v",
        vector          "u",
        vector          "v",
        integer         "mode",
        array light     "lights")
ambience
is a multiplier for the ambient color. The idea is that ambient and diffuse color can be derived from the same subshader result (a texture mapper, for example) and the ambient brightness can be reduced to avoid losing the effect of illumination.
ambient
is a constant color offset.
diffuse
is added to the result for each light, after multiplication with the color returned by the light and a weight based on the dot product of the incident ray direction and the light direction.
glossy
is also added per light. It is the glossy color computed according to Ward's anisotropic glossy reflection model.
shiny_u
shiny_v
controls the width of the glossy highlight in the u and v directions, respectively. Smaller values increase the size of the highlight.
u
v
the brushing directions in the anisotropic material. They must be perpendicular to each other and to the surface normal, and of unit length. Such vectors are generated by the mib_texture_rotate shader intended to drive these input parameters.
mode
controls which lights to use, see light lists.
lights
is a list of light instances used for light lists.

Ward with surface derivatives

Perform Ward illumination, given ambient, diffuse, and glossy RGB colors, two shinyness parameters, and a light list. The only difference from mib_illum_ward is that the brushing directions are taken from the surface derivatives.

mib_illum_ward_deriv
    color "mib_illum_ward_deriv" (
        color           "ambience",
        color           "ambient",
        color           "diffuse",
        color           "glossy",
        scalar          "shiny_u",
        scalar          "shiny_v",
        integer         "mode",
        array light     "lights")
ambience
is a multiplier for the ambient color. The idea is that ambient and diffuse color can be derived from the same subshader result (a texture mapper, for example) and the ambient brightness can be reduced to avoid losing the effect of illumination.
ambient
is a constant color offset.
diffuse
is added to the result for each light, after multiplication with the color returned by the light and a weight based on the dot product of the incident ray direction and the light direction.
glossy
is also added per light. It is the glossy color computed according to Ward's anisotropic glossy reflection model.
shiny_u
shiny_v
controls the width of the glossy highlight in the u and v directions, respectively. The u direction is the first derivative of the surface (read from the state), and v is perpendicular. Both u and v are in the plane that is perpendicular to the surface normal.
mode
controls which lights to use, see light lists.
lights
is a list of light instances used for light lists.

Cook-Torrance

Perform Cook-Torrance illumination, given ambient, diffuse, and specular RGB colors, a roughness, index of refraction for three wavelengths, and a light list. Cook-Torrance illumination has an off-specular peak and a color shift with angles.

mib_illum_cooktorr
    color "mib_illum_cooktorr" (
        color           "ambience",
        color           "ambient",
        color           "diffuse",
        color           "specular",
        scalar          "roughness",
        color           "ior",
        integer         "mode",
        array light     "lights")
ambience
is a multiplier for the ambient color. The idea is that ambient and diffuse color can be derived from the same subshader result (a texture mapper, for example) and the ambient brightness can be reduced to avoid losing the effect of illumination.
ambient
is a constant color offset.
diffuse
is added to the result for each light, after multiplication with the color returned by the light and a weight based on the dot product of the incident ray direction and the light direction.
specular
is a factor that the reflected color is multiplied with.
roughness
is the average microfacet slope of the surface. It controls the width of the specular highlight.
ior
is the index of refraction of the material at three different wavelengths (red, green, blue). Metals typically have a higher index of refraction than glass. Values must be 1.0 or greater; smaller values are clamped to 1.0.
mode
controls which lights to use, see light lists.
lights
is a list of light instances used for light lists.

Blinn

Perform Blinn illumination, which is a like Cook-Torrance illumination but without the color shift with angles. It only requires one index of refraction.

mib_illum_blinn
    color "mib_illum_blinn" (
        color           "ambience",
        color           "ambient",
        color           "diffuse",
        color           "specular",
        scalar          "roughness",
        scalar          "ior",
        integer         "mode",
        array light     "lights")
ambience
is a multiplier for the ambient color. The idea is that ambient and diffuse color can be derived from the same subshader result (a texture mapper, for example) and the ambient brightness can be reduced to avoid losing the effect of illumination.
ambient
is a constant color offset.
diffuse
is added to the result for each light, after multiplication with the color returned by the light and a weight based on the dot product of the incident ray direction and the light direction.
specular
provides the color of specular highlights.
roughness
is the average microfacet slope of the surface. It controls the width of the specular highlight.
ior
is the index of refraction of the material. Metals typically have higher index of refraction than glass.
mode
controls which lights to use, see light lists.
lights
is a list of light instances used for light lists.

Hair

Perform illumination on hair geometry similar to Phong. Hair requires specialized shaders because they are not shading regular triangles but procedural flat-ribbon geometry. Note, that special shaders should be used in parameter connections which can deal with the differences in shading or texture mapping on hair geometry.

mib_illum_hair
    color "mib_illum_hair" (
        color           "ambience",
        color           "ambient",
        color           "diffuse",
        color           "specular",
        scalar          "exponent",
        integer         "mode",
        array light     "lights")
ambience
is a multiplier for the ambient color.
ambient
is a constant color offset.
diffuse
is added to the result for each light, after multiplication with the color returned by the light and a weight based on the dot product of the incident ray direction and the light direction.
specular
provides the color of specular highlights.
exponent
controls the width of the specular highlight.
mode
controls which lights to use, see light lists.
lights
is a list of light instances used for light lists.

Light Lists

All illumination shaders above have a mode parameter and a lights parameter to control the set of lights which is used for illumination. Illumination is performed either using the light instances given in the lights parameter, or the light list of the geometry instance to be shaded. Using the light lists assigned to scene objects allows to share a common shader even on objects with different light relations. The lights are used according to the following possible values for the mode parameter:

0
illumination using the lights parameter; if no lights are specified, then using the instance light list; if no instance light list is specified, then using all lights in the scene. This is the default.
1
illumination using the specified lights in inclusive mode, i.e., instances of groups of light instances are evaluated to all light instances in the group
2
illumination using the specified lights in exclusive modes, i.e., using all lights except the specified ones
4
illumination ignoring any specified lights, and using the instance light list. If no instance light list is specified then all light instances in the scene are used.

Copyright (©) 1986-2008 by mental images GmbH