颜色校正曲线 Color Correction Curves

作者:雨辰 发布于:2016-4-11 14:59 Monday 分类:Unity3D

Color Correction Curves make color adjustments using curves for each color channel. Depth based adjustments allow you to vary the color adjustment according to a pixel's distance from the camera. For example, objects on a landscape typically get more desaturated with distance due to the effect of particles in the atmosphere scattering.

色彩校正曲线使用曲线调整每一个颜色通道。基于"深度"的调整允许我们根据摄像机与目标物的像素距离调整其颜色。例如,由于大气散射的存在,远处的物体通常饱和度更低。

Selective adjustments can also be applied, so you can swap a target color in the scene for another color of your own choosing.

也可以选择性的对场景中的一个目标颜色进行调整,将其换成你想要的颜色。

Lastly, Saturation is an easy way to adjust all color saturation or desaturation (until image turns black & white) which is an effect that is not achievable with curves only.

最后,饱和度是很容易的方法来调节所有颜色的饱和度或降低饱和度(直到图像变为黑白)这是仅曲线无法达到的效果。

See also the new Color Correction Lut effect for lookup texture based color grading.

参见新的Color Correction Lut effect是基于颜色分级。

The following images demonstrate how by simply enhancing the saturation slider and the blue channel curve can make a scene drastically different

下面的图像演示了怎样通过简单增加饱和度滑块和蓝色通道曲线来制作显著不同的场景。

As with the other image effects, this effect is only available in Unity Pro and you must have the Pro Standard Assets installed before it becomes available.

跟其他图像处理特效一样,该特效目前只在Unity Pro版本中有效,而且在使用之前必须要安装Pro Standard Assets。

Properties 属性

  • Mode 模式
    Chose between advanced or simple configuration modes.
    在高级或简单配置模式之间切换
  • Saturation 饱和度
    Saturation level (0 creates a black & white image).
    饱和度级别(0为黑白图像)
  • Red 红色
    The red channel curve. 红色通道曲线
  • Green 绿色
    The green channel curve.绿色通道曲线
  • Blue 蓝色
    The blue channel curve. 蓝色通道曲线
  • Red (Depth) 红(深度)
    The red channel curve for depth based correction.
    基于深度调整的红色通道曲线
  • Green (Depth) 绿(深度)
    The green channel curve for depth based correction.
    基于深度调整的绿色通道曲线
  • Blue (Depth) 蓝(深度)
    The blue channel curve for depth based correction.
    基于深度调整的蓝色通道曲线
  • Blend Curve 混合曲线
    Defines how blending between the foreground and background color correction is performed.
    决定前景和背景颜色校正之间的如何混合
  • Selective Color Correction
    选择性颜色校正
  • Enable 启用
    Enables the optional selective color correction.
    启用可选选择性颜色校正
  • Key 关键色
    The key color for selective color correction.
    选择性颜色校正关键色
  • Target 目标色
    The target color for selective color correction.
    选择性颜色校正目标色

Understanding Curves 理解曲线

Curves offer a powerful way to enhance an image and can be used to increase or decrease contrast, add a tint or create psychedelic color effects. Curves work on each of the red, green and blue color channels separately and are based around the idea of mapping each input brightness level (ie, the original brightness value of a pixel) to an output level of your choosing. The relationship between the input and output levels can be shown on a simple graph:-

曲线是改善图像的有力工具,它可被用来降低或升高对比度、加入染色,或者创造出一种迷幻色彩。曲线调整对红绿蓝三个颜色通道独立起作用,其基本思想是将每一个输入的亮度值(比如,原始的像素亮度值)映射到你最终选择的那个值上。这张简单的图显示了输出值和输入值之间的关系

The horizontal axis represents the input level and the vertical represents the output level. Any point on the line specifies the output value that a given input is mapped to during processing. When the "curve" is the default straight line running from bottom-left to top-right, the input value is mapped to an identical output value, which will leave the pixel unchanged. However, the curve can be redrawn to re-map the brightness levels as required. A simple example is when the line goes diagonally from top-left to bottom-right:-

X 轴显示输入值,Y轴显示输出值,线上的任意一个点都表示实时的输出输入对应关系。当曲线是默认的一条从左下角到右上角的直线时,意味着输入的值被映射到相 同的输出值,像素值将保持不变。当然,曲线可以改变,以重新映射所需的亮度级。比如这样一个简单的例子,曲线沿对角线从左上角到右下角。

In this case, the pixel's brightness will be inverted; 0% will map to 100%, 25% to 75% and vice versa. If this is applied to all color channels then the image will be like a photographic negative of the original.

在这种情况下,像素的亮度将被反转,0%将映射到100%,25%至75%,反之亦然。如果这是对所有颜色通道的操作,图像会像照相底片一样反转。

Contrast 对比度

Most of the detail in an image is conveyed by the difference in brightness levels between pixels, regardless of their colour. Pixels that differ by less than about 2% brightness are likely to be indistinguishable but above this, the greater the difference, the greater the impression of detail. The spread of brightness values in the image is referred to as its contrast.

图像中的大部分细节都通过像素之间的亮度差来表现,而不是它们的颜色。像素之间的亮度差小于约2%时可能无法区分,但在此之上,差别越大,就意味着更多的细节表现。图像中的亮度值的传播因此被称为对比度。

If a shallow slope is used for the curve, rather than the corner-to-corner diagonal then the full range of input values will be squeezed into a narrower range of output values:-

如果使用一条斜率较小的曲线,而不是角对角的对角线,输入值将被挤压到一个较窄范围的输出值。

This has the effect of reducing the contrast, since the differences between pixel values in the output are necessarily smaller than those in the input (indeed, two slightly different input values may actually get mapped to the same output value). Note that since the image no longer spans the full range of output values, it is possible to slide the curve up and down the range, resulting in an image which is brighter or darker overall (the average brightness is sometimes called the "sit" point and is the parameter adjusted by the brightness control on a TV set). Reduced contrast can give the impression of gloom, fog or a dazzling light source in a scene, depending on the overall brightness.

这具有减小对比度的效果,因为在输出像素值之间的差异是必然小于输 入(事实上,两个略微不同的输入值实际上可能映射到相同的输出值)。需要注意的是,由于图像不再包含在完整的输出值范围内,如果我们上下调整曲线,将使图 像整体上更亮或更暗(平均亮度有时也被称为"sit"点,这个点的调整就像我们在电视机上调亮度旋钮)。在一个场景中,在总亮度确定的情况下降低对比度给 人一种的阴霾,雾或发出耀眼的光源的感觉。

It is not necessary to reduce the contrast across the whole range of brightness levels. The curve's slope can vary along its length, with the shallower parts corresponding to ranges of reduced contrast. In between the shallow parts, the slope may be steeper than the default, and the contrast will actually increase in these ranges. Changing the curve like this gives a useful way to increase contrast in some parts of the image while reducing it in areas where the detail is less important:-

我们不 必要在整个亮度范围内降低对比度,曲线的斜率可以根据它的长度改变。平坦的部分代表更低的对比度,而在两个平坦曲线之间也可以有陡峭的部分,这个陡峭的部 分可以比常规的更加剧烈,从而升高这一部分的对比度。调整曲线像下面这张图这样,可以让物体的某个重要的部分对比度增高,来降低那些不太重要的部分。

Colour Effects 颜色效果

If the curves are set identically for each color channel (red, green and blue) then the changes will mainly affect the brightness of pixels while their colors remain relatively unchanged. However, if the curves are set differently for each channel then the colors can change dramatically. Many complex interactions between the color channels are possible but some basic insight can be gained from the following diagram:-

如果曲线同时作用于三个颜色通道(红绿蓝),曲线将只影响到亮度,颜色将不会改变。曲线设定在任何单独的颜色通道将使这种颜色剧烈改变。有很多颜色通道相互作用的例子但是下面这张图显示了通道之间作用的基本方式。

As explained in the section above, a reduction of contrast can accompany an increase or reduction in the overall brightness. If, say, the red channel is brightened then a red tint will be visible in the image. If it is darkened then the image will be tinted towards cyan (since this color is obtained by combining the other two primaries, green and blue).

正如前面解释的,对比度的降低将同时降低总体亮度。这样,如果我们提高红色通道,图像将显现额外的红色;反之,图像将呈现更多的青色(青色由另外两种基本色混合而成:绿+蓝)

Depth-Based Color Correction 基于深度颜色校正

Colors often appear slightly different when viewed at a distance. For example, in a landscape scene, colors tend to get desaturated by atmospheric light scattering. This kind of effect can be created using depth-based color correction. When this is enabled, two sets of color curves become available, one for the camera's near clipping plane and the other for the far clipping plane. The actual correction applied to an object depends on its distance from the camera; the normalized distance between the two clipping planes is used as an interpolation parameter between the two sets of color curves. The exact type of interpolation is specified by an additional blending curve, which maps the normalised distance to an interpolation value in much the same way that a color curve maps an input to an output. By default, this curve is a straight diagonal which results in linear interpolation between the two color corrections. However, it can be modified to bias the correction according to distance.

当我们从远处看一个物体时颜色经常有 轻微的变化。由于大气散射的存在,我们看风景时物体颜色的饱和度会略微降低。这种效果可以通过Depth-Based Color Correction来模拟。当这个选项被激活时,我们可以同时调整两条曲线,一个作用在摄像机的近点,另一个是远点平面。物体依据它与摄像机之间的距离 进行颜色调整。近、远点之间的部分用两个曲线的插补参数决定。具体的插补方式遵照于一个额外的混合曲线,这条曲线将距离投射到一个插补值,就像我们前面提 到的颜色校正曲线将输入值投射到输出值那样。这条曲线默认是一条对角线,在两种颜色校正系统中提供一个线性插补。当然,我们可以调整它,使根据距离的调整 更为优先。

Selective Color Correction 选择性色彩校正

Using this setting, it is possible to replace a particular color in the original image (referred to as the "key") and replace it with a chosen target color. Using a single exact color for the key would tend to introduce visual artifacts and so a range is used instead. The resulting color is an interpolation between the key and target colors, depending on how close the original image pixel is to the specified key color.

这个功能可以用一个选择的颜色来取代源图像上的某个特定颜色(称为 "key")。用一个单色这么做的时候图像看起来感觉很假,因此我们用一个颜色范围代替单色。最终结果介于两种颜色之间。取决于原始图像的像素颜色和我们选择的颜色之间的相似度。

Editing Curves 编辑曲线

Clicking on one of the curves in the inspector will open an editing window:-

在inspector视图中点击任何一个curve将会打开编辑窗口:

At the bottom of the window are a number of presets for common curves. However, you can also alter the curve by manipulating the key points. Right clicking on the curve line will add a new key point which can be dragged around with the mouse. If you right click on one of the points, you will see a contextual menu that gives several options for editing the curve. As well as allowing you to delete the key, there are four options that determine how it will affect the shape of the curve:-

窗口底部列出了常见的curve类型,你可以调节控制点改变曲线。右击曲线加入新的控制点,左键可以拖动它,如果你右击控制点,你将会看见一个菜单,里面列出了编辑曲线的可用操作。你也可以删除控制点,选择四种选项之一决定删除操作影响到曲线的方式。

  • Auto: the curve will pass through the point and its shape will be adjusted to keep the curvature smooth between neighbouring points.
    自动:曲线仍旧通过这个点,曲线形状根据相邻的两个点自动调节并保持曲线平滑
  • Free Smooth: the tangent of the curve can be edited using handles attached to the key point.
    自由平滑:曲线的切线可以通过key point上的控制柄调节
  • Flat: Free Smooth mode is enabled and the tangent is set horizontally.
    平滑:模式可用,曲线切线将变水平
  • Broken: The key point has tangent handles as with Free Smooth mode but the handles on the left and right of the curve can be moved separately to create a sharp break rather than a smooth curve.
    折断:控制点有像Free Smooth 模式那样的控制柄,但是它的两条控制柄可以分别调整,这样可以调节出剧烈变化的曲线形式。

Below these options are a few settings that control how a point's tangent handles behave:-

在这些选项之下还有一些选项用来调整控制柄调整曲线切线的方式:

  • Free: Broken mode is enabled for the curve at the specified tangent.
    自由:在特定的切线上Broken模式被激活。
  • Linear: The curve between the key point and its neighbour is set to a straight line.
    线性:关键点和它相邻点之间的曲线变成直线
  • Constant: A flat horizontal line is drawn from the curve to its neighbour and the vertical displacement occurs as a sharp step.
    常数:相邻点之间的曲线部分变成垂直。

Hardware support 硬件支持

This effect requires a graphics card with pixel shaders (2.0) or OpenGL ES 2.0. Additionally, depth texture support is required. PC: NVIDIA cards since 2004 (GeForce 6), AMD cards since 2004 (Radeon 9500), Intel cards since 2006 (GMA X3000); Mobile: OpenGL ES 2.0 with depth texture support; Consoles: Xbox 360, PS3.

这个特效需要显卡拥 有像素着色器(2.0)或者OpenGL ES 2.0。台式机:2003年以后的NVIDIA显卡(GeForce FX),2004年以后的AMD显卡(Radeon 9500),2005年以后的Intel卡(GMA 900);移动设备:OpenGL ES 2.0;控制台: Xbox 360、 PS3。

All image effects automatically disable themselves when they can not run on end-users graphics card.

所有图像特效如果无法在用户显卡上运行时将会自动被关闭。

标签: Unity3D-优化性能 Unity3D

发表评论:

雨辰 joyimp|@2011-2017 京ICP备16030765号