Convert a color to RGBA grayscale, either by extracting the alpha component, by averaging RGB, or by weighting RGB according to a physiological color model that emphasizes green and deemphasizes red. The resulting grayscale value can also be used as a scalar. The returned R, G, B, and A components all have the same value.
color "mib_color_alpha" ( color "input", scalar "factor")
color "mib_color_average" ( color "input", scalar "factor")
color "mib_color_intensity" ( color "input", scalar "factor")
Given a scalar or a color, perform a lookup and interpolation of a multicolor map. The map is a set (not array) of up to 8 colors. The actual number of colors is specified by a parameter.
color "mib_color_interpolate" ( scalar "input", integer "num", scalar "weight_1", scalar "weight_2", scalar "weight_3", scalar "weight_4", scalar "weight_5", scalar "weight_6", color "color_0", color "color_1", color "color_2", color "color_3", color "color_4", color "color_5", color "color_6", color "color_7")
Accepts a base color and up to 8 inputs (the exact number is determined by a parameter), each of which consists of an input color, a weight scalar, and a mode. The inputs are evaluated in sequence, each operating on the result of the previous one (the first begins with the base color, which defaults to transparent black). The following modes are supported:
mode | operation | calculation |
---|---|---|
0 | Blend | R = A·(1−Ba)·w + B·w |
1 | Mix | R = A·(1−w) + B·w |
2 | Add | R = A + B·w |
3 | Bounded Add | R = bound(A + B·w, 0, 1) |
4 | Multiply | R = A·B·w |
5 | Bounded Multiply | R = bound(A·B·w, 0, 1) |
6 | Replace Alpha | Rrgb = Argb; Ra = Ba |
R is the next result, A is the previous result, B is the current color, and w is the current weight. The subscripts r, g, b, and a are red, green, blue, and alpha components. Note that mode 6 does not ensure that the resulting alpha value is valid, that is, not less than red, green, or blue. mental ray will correct alpha when storing the color in the frame buffer unless premultiplication is turned off.
color "mib_color_mix" ( integer "num", integer "mode_0", integer "mode_1", integer "mode_2", integer "mode_3", integer "mode_4", integer "mode_5", integer "mode_6", integer "mode_7", scalar "weight_0", scalar "weight_1", scalar "weight_2", scalar "weight_3", scalar "weight_4", scalar "weight_5", scalar "weight_6", scalar "weight_7", color "color_0", color "color_1", color "color_2", color "color_3", color "color_4", color "color_5", color "color_6", color "color_7", color "color_base")
Fan out one color input to up to 8 color outputs (the exact number is determined by a parameter). Each output is equal to the corresponding input, multiplied by a weight, with a given conversion. The equations are
mode | operation | calculation |
---|---|---|
0 | Weighted Color | R = w·A |
1 | Grayscale Color from Alpha | Rrgba = w·Aa |
2 | Grayscale Color from Average Intensity | Rrgba = w·(Ar+Ag+Ab) ⁄ 3 |
3 | Grayscale Color from Weighted Intensity | Rrgba = w·(0.299·Ar+ 0.587·Ag+ 0.114·Ab) |
4 | Grayscale Color from Red Component | Rrgba = w·Ar |
R is the current (one of up to eight) result, w is the current weight, mode is the current conversion, and A is the input color shared by all outputs. Mode 4 is intended for converting a scalar to a grayscale color.
struct { color "out_0", color "out_1", color "out_2", color "out_3", color "out_4", color "out_5", color "out_6", color "out_7" } "mib_color_spread" ( color "input", integer "num", integer "mode_0", integer "mode_1", integer "mode_2", integer "mode_3", integer "mode_4", integer "mode_5", integer "mode_6", integer "mode_7", color "weight_0", color "weight_1", color "weight_2", color "weight_3", color "weight_4", color "weight_5", color "weight_6", color "weight_7")
Copyright (©) 1986-2008 by mental images GmbH