运算节点

../../../_images/compositing_types_converter_math_node.png运算节点。

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

输入

  • 第一个数值。可以输入三角法则定义的弧度数值。
  • 第二个数值。这个数值不仅可输入三角函数值,还可以输入四舍五入及绝对值。

属性

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

输出

  • 数值输出。

范例

自定义Z深度通道节点设置

../../../_images/compositing_types_converter_math_manual-z-mask.png最大值与最小值功能举例。

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

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

使用正弦功能得到不断循环的变化数

../../../_images/compositing_types_converter_math_sine.png使用正弦功能举例。

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.

范例中有一个 运算: 相乘 节点增加图像的亮度通道(Y)使其颜色变得更亮。使用 映射值 节点的 “使用最小值” 和 “使用最大值”复选框来限定颜色的输出值在合理的区间范围之内。用这个方法,用户可以在高动态范围图像(HDRI)上应用对数函数。在这个特定范例中,使用一个 亮度/对比度 节点 对亮度进行简单控制。

Restrict Color Selection (Posterization)

../../../_images/compositing_types_converter_math_posterization.pngPosterization 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).

In the case of a color image,you need split it into separate RGB channels using Separate/Combine RGBA nodesand perform this operation on each channel independently.