Keywords: main

Next: 1.7 Data Conversion Up: 1. Base Shaders/A> Previous: 1.5 Sample Compositing

# 1.6 Illumination

Lambert

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

        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 light direction and the light direction.

mode controls the meaning of the light list: all, inclusive, or exclusive. All is faster than inclusive, and inclusive is faster than exclusive.

lights is a list of light instances to loop over. If the mode is 0, use every light in the light list parameter. If the mode is 1, use all lights in the global light list that correspond to the lights in the light list parameter (inclusive mode). If the mode is 2, use all lights in the global light list that do not correspond to the lights in the light list parameter (exclusive mode).

Phong

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

        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 light 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 the meaning of the light list: all, inclusive, or exclusive.

lights is a list of light instances to loop over. If the mode is 0, use every light in the light list parameter. If the mode is 1, use all lights in the global light list that correspond to the lights in the light list parameter (inclusive mode). If the mode is 2, use all lights in the global light list that do not correspond to the lights in the light list parameter (exclusive mode).

Ward

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

        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 light 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 and 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 is the brushing direction in the anisotropic material. They must be perpendicular to the surface normal and be of unit length.

v is a direction perpendicular to u and to the surface normal. It must have unit length.

mode controls the meaning of the light list: all, inclusive, or exclusive.

lights is a list of light instances to loop over. If the mode is 0, use every light in the light list parameter. If the mode is 1, use all lights in the global light list that correspond to the lights in the light list parameter (inclusive mode). If the mode is 2, use all lights in the global light list that do not correspond to the lights in the light list parameter (exclusive mode).

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.

        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 light 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 and 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 the meaning of the light list: all, inclusive, or exclusive.

lights is a list of light instances to loop over. If the mode is 0, use every light in the light list parameter. If the mode is 1, use all lights in the global light list that correspond to the lights in the light list parameter (inclusive mode). If the mode is 2, use all lights in the global light list that do not correspond to the lights in the light list parameter (exclusive mode).

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.

        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 light 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 the meaning of the light list: all, inclusive, or exclusive.

lights is a list of light instances to loop over. If the mode is 0, use every light in the light list parameter. If the mode is 1, use all lights in the global light list that correspond to the lights in the light list parameter (inclusive mode). If the mode is 2, use all lights in the global light list that do not correspond to the lights in the light list parameter (exclusive mode).

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.

        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 light 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 the meaning of the light list: all (0), inclusive (1), or exclusive (2).

lights is a list of light instances to loop over. If the mode is 0, use every light in the light list parameter. If the mode is 1, use all lights in the global light list that correspond to the lights in the light list parameter (inclusive mode). If the mode is 2, use all lights in the global light list that do not correspond to the lights in the light list parameter (exclusive mode).

Next: 1.7 Data Conversion Up: 1. Base Shaders/A> Previous: 1.5 Sample Compositing