运算节点

    运算节点 的功能是执行数学运算。

    • 第一个数值。可以输入三角法则定义的弧度数值。
    • 操作
    • 添加,相减,相乘(软件界面翻译成正片叠底,这个是在图层模式才有的说法),相除,正弦,余弦,正切,反正弦,反余弦,反正切,反正切2,乘幂运算,对数运算,最小值,最大值,四舍五入,小于,大于,模数,绝对值
    • 限定
    • 限定输出数值的范围(0到1)。参看 。

    最大值与最小值功能举例。

    此范例场景输入数据由 渲染层 节点提供,距离摄影机10BU左右有个矩形物体。在另一个渲染层节点底部的输入连接端口上连有一个覆盖视图左半部距离摄影机7BU单位的平面。两个渲染层节点通过映射值节点分离Z缓冲区(Z深度)为20(乘以0.5,输入框如图所示)并且最小值/最大值的范围限分别限定在 0.0/1.0。

    “使用最小值”功能是依据靠近摄影机的像素将Z深度值选择出来;也可以选择矩形部分的平面Z深度值。背景有个初始的Z深度值,值限定为1.0(显示为白色)。在“使用最大值”范例中,矩形的Z深度值比图像平面要大,因此更靠近左侧,但是图像平面(FlyCam)渲染层Z值初始在右侧(对应于1.0),因此他们被选择。

    This example has a Time node putting out a linear sequence from 0 to 1 over the course of 101 frames.At frame 25, the output value is 0.25.That value is multiplied by 2 × pi (6.28) and converted to 1.0 by the Sine function,since we all know that (sin(2 × pi/ 4) = sin(pi/ 2) = +1.0).

    Since the sine function can put out values between (-1.0 to 1.0),the Map Value node scales that to 0.0 to 1.0 by taking the input (-1 to 1), adding 1(making 0 to 2), and multiplying the result by one-half (thus scaling the output between 0 to 1).The default Color Ramp converts those values to a gray-scale.Thus, medium gray corresponds to a 0.0 output by the sine, black to -1.0,and white to 1.0. As you can see, (sin(pi/ 2) = 1.0). Like having your own visual color calculator!Animating this node setup provides a smooth cyclic sequence through the range of grays.

    将这个功能引申,比如,图片的alpha通道形成渐入/渐出特效。改变Z深度通道的景深位置。改变颜色通道值使其有规律的进行色彩变化。

    ../../../_images/compositing_types_converter_math_multiply.pngScaling a channel example.

    Posterization example.

    In this example, we restrict the color values to be one of the six values: 0, 0.2, 0.4, 0.6, 0.8, 1.

    To split up a continuous range of values between 0 and 1 to certain set of values,the following function is used: (round(x × n - 0.5) / (n - 1)),where "n" is the number of possible output values, and "x" is the input pixel color.Read more about this function.

    To implement this function in Blender, consider the node setup above.We string the math nodes into a function that takes each color (values from 0 to 1),multiplies it up by six, the desired number of divisions (values become from 0 to 6),offsets it by 0.5 (-0.5 to 5.5),rounds the value to the nearest whole number (produces 0, 1, 2, 3, 4, 5),and then divides the image pixel color by five (0.0, 0.2, 0.4, 0.6, 0.8, 1.0).