颜色渐变节点

../../../_images/compositing_node-types_CompositorNodeValToRGB.png

颜色渐变节点。

颜色渐变节点使用渐变的方式进行颜色值的匹配。

输入

系数

系数输入连接端口用于颜色渐变的索引(即需要此节点处理的输入素材图片)。

属性

颜色渐变

渐变条控制项功能参见 颜色渐变部件

输出

图像

标准化图像输出。

Alpha通道

标准化遮罩输出。

范例

创建Alpha遮罩

An often overlooked use case of the Color Ramp is to create an alpha mask, or a mask that is overlaid on top of another image. Such a mask allows you to select parts of the background to be show through.

../../../_images/compositing_types_converter_color-ramp_create-alpha-mask.png

使用颜色渐变节点来创建alpha遮罩。

在上面的节点图中,旋转旋涡的灰度图,本身不带有alpha通道,将此图片连接到颜色渐变节点的 系数 输入端口上(专业上来说,首先应该把图像颜色值通过RGB -> BW 节点进行转换,恰好我们这个例子使用的就是BW格式图像,所以这步省略了。备注:BW是包含各种像素信息的一种黑白图形文件格式)。

The Color Ramp node is set to a purely transparent color on the left end of the gradient, and a fully red color on the right. As you can see in the Viewer node, the Color Ramp node puts out a mask that is fully transparent where the image is black. Black is zero, so Color Ramp outputs the color at the left end of the gradient, which is set to transparent. The Color Ramp image is fully red and opaque where the image is white (which is 1).

我们可以看出图像遮罩输出实际上是覆盖在另一张图像上面使其遮挡不显示的部分,使需要的部分显示出来。

彩色化图像

In this example multiple colors are added to the color gradient converting a black-and-white image into a flaming swirl.

../../../_images/compositing_types_converter_color-ramp_colorizing-image.png

The shades of gray in the input image are mapped to three colors: blue, yellow, and red, all fully opaque (alpha of 1). Where the image is black, Color Ramp substitutes blue (the first color stop). Where it is some shade of gray, Color Ramp outputs a corresponding color from the gradient (bluish, yellow, to reddish). Where the image is fully white, the Color Ramp outputs red.