Unity3D图像后处理特效——Color Correction image effect

来源:互联网 发布:淘宝电热护肩定制 编辑:程序博客网 时间:2024/05/17 01:13

Color Correction allows you apply arbitrary color correction to your scene as a postprocessing effect (just like the Curves tool in Photoshop or Gimp). This page explains how to setup color correction in Photoshop and then applyexactly the same color correction at runtime in Unity.

颜色校正作为一种后处理特效允许您将任意的校正颜色应用于你的场景(就像 Photoshop Gimp 中的曲线工具)。本页说明如何在 Photoshop中设置颜色校正,然后在Unity中如何在程序运行时应用完全相同颜色校正。

 

Like allimage effects, Color Correction is only available in Pro version of Unity. Make sure to have the Pro Standard Assets installed.

和其他图像特效一样,该特效只能在Unity Pro上进行使用,并且在使用之前必须安装Pro Standard Assets

Color correction applied to the scene. Color ramp used (magnified) is shown at the right.

应用于场景的颜色校正特效。所用的颜色渐变图可见右方。


Color ramp used for the image above.

上面图片所用的颜色渐变图。

 

Getting color correction from Photoshop into Unity               PhotoShop中得到颜色渐变图并应用于Unity

 

1.      Take a screenshot of a typical scene in your game

         在游戏中取一张典型场景的截图

2.      Open it in Photoshop and color correct using the Image->Adjustments->Curves

         在PhotoShop中打开它,并使用Image->Adjustments->Curves进行颜色校正

3.      Save the .acv file file from the dialog usingSave...

         使用Save...保存.acv文件

4.      Open Pro Standard Assets->Image Based->color correction ramp.png in Photoshop

         在Photoshop中打开Pro Standard Assets->Image Based->color correction ramp.png

5.      Now apply color correction to the ramp image: open Image->Adjustments->Curves again and load your saved.acv file

         现在在渐变图像中进行颜色渐变处理:再次打开Image->Adjustments->Curves,并导入你保存的.acv文件

6.      Select your camera in Unity and select Component->Image Effects->Color Correction to add color correction effect. Select your modified color ramp.

         在Unity中选择你的照相机,选择选项Component->Image Effects->Color Correction来加入颜色校正特效。选择你修改过的渐变颜色。

7.      Hit Play to see the effect in action!

         点击Play来看效果。

 

Details               细节

Color correction works by remapping the original image colors through the color ramp image (sized 256x1):

颜色校正特效是将颜色渐变图像映射到原始图像上所得到的效果:

1.      result.red = pixel's red value in ramp image at (original.red +RampOffsetR) index

result.red =渐变图像上索引为(original.red +RampOffsetR)的像素红色通道值

2.      result.green = pixel's green value in ramp image at (original.green +RampOffsetG) index

result.green =渐变图像上索引为(original. green +RampOffsetG)的像素绿色通道值

3.      result.blue = pixel's blue value in ramp image at (original.blue +RampOffsetB) index

result.blue =渐变图像上索引为(original. blue +RampOffsetB)的像素蓝色通道值

So for example, to invert the colors in the image you only need to flip the original color ramp horizontally (so that it goes from white to black instead of from black to white).

例如,要反相图像中的颜色你只需要水平地翻转颜色渐变曲线(以便它从白色变为黑色而不是从黑色到白色)。

A simpler version of color remapping that only remaps based on luminance can be achieved withGrayscale image effect.

一个只基于亮度的颜色重映射的简单版本通过结合灰度图像特效结果来达到。

 

Tips:

提示:

        The color correction ramp image should not have mip-maps. Turn them off in Import Settings. It should also be set toClamp mode.

      颜色校正渐变图像不应该拥有mip-map。在Import Settings中将其关闭,同时它应该是Clamp模式。

 

Hardware support        硬件支持

This effect requires a graphics card with pixel shaders (2.0) or OpenGL ES 2.0. PC: NVIDIA cards since 2003 (GeForce FX), AMD cards since 2004 (Radeon 9500), Intel cards since 2005 (GMA 900); Mobile: OpenGL ES 2.0; Consoles: Xbox 360, PS3.

这个特效需要显卡拥有像素着色器(3.0)或者OpenGL ES 2.0。台式机:2003年以后的NVIDIA显卡(GeForceFX),2004年以后的AMD显卡(Radeon9500),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.  

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

原创粉丝点击