博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Color correction
阅读量:2438 次
发布时间:2019-05-10

本文共 4689 字,大约阅读时间需要 15 分钟。

Introduce

    Color correction is general term(refer to wiki), in video game, it's also called 'color grading'.

        Color grading is the process of altering and enhancing the color of a motion picture, video image, or still image either electronically, photo-chemically or digitally.    ---- From wiki page

    In theory, it's done by mapping a color to another color. Gamma correction is most famous color correction effect. It will transform RGB color to sRGB color with power(2.2) operation. Most of the time, this kind of mapping will include many complex operations. To accelerate real-time performance, most of game will use a 3D lookup table to realize color grading. This 3D lookup texture should be with very small size and usually offline created by artist outside of game engine by 3rd party software(such as Photoshop). Also, it can be generated dynamically.

Ideas

    Most of photo process and video process software support color correction in some kind of way. 

 

 

    In general, there are two solutions for adjusting color grading:

    1. A curve can be modified by some key points:

Color Curve in GIMP

    Very powerful and more flexible to control. But it's hard to understand for artist. some parameters based curve should be applied such as bezier curve.

    2. Some predefined effect with parameters:

    

Brightness and Contrast in GIMP

    More easy to understand.So, most of software will support it.

 

    There's many kinds of color correction effect exist. Different software will support different subset of them.

  • Brightness
    Make whole scene more bright or more dark.
  • Contrast
    Make whole scene have more contrast, dark more dark, bright more bright.With negative value, it will reduce the effect. 
  • Hue
    Change color hue.
  • Saturation
    Change color saturation.
  • Exposure
    Control the exposure of image.
  • Color balance
    Control the color balance of image.
  • Gamma
    Normally, convert from RGB to sRGB.
  • ...

 

    When combining different effects together, three different solutions exist:

    1. Each effect is treated as one node with parameters. Then all effect nodes will applied one by one according the order in the sequence.

    2. Some effects are combined into small groups. A static order of the effects are used in the group. Several small group will be applied one by one.

    3. Combine all supported effects into one group. The group can be applied more than once.

 

     Most of software also support only affect these effect on separate color channel(R, G, B, H, S, V, L). Some of effect can only affect shadows(such as [0,0.2]), midtones(such as (0.2,0.7]), highlights(such as (0.7,1.0]). Different software have different subset of color correction effects. Even same color correction effect will be implemented by different method(mathematical function or curve). 

Conclusion

    As previous description about Lynx color correction feature and the research result of different software. Following is the design:

    1. A new computer shader will be used to generate 3D LUT texture at runtime; It should be executed every frame or only some special frame according to performance requirement;

    2. The 3D LUT texture should be small size to reduce the texture fetching cost on GPU; At same time keeping good visual quality; Similar with Trials Fusion, it's 32x32x16.

    3. To keep high performance and simplify the usage, all support color correction features are combined into one shader with static order:

  • Contrast
  • Hue, Saturation and Exposure
  • Brightness
  • Color balance
  • Gamma

     4. Different color correction effect has some parameter to control result. They are all exposed in shader constant buffer, the correct values are need to calculated in CPU side.

     Detail implementation refer to HDR demo.

 

     There are many color correction effects for different purpose, current implementation only realize basic color correction effect. Some other effect can be added later according to requirement. 

  • Contrast
    <new color> = <old color> + <contrast> * (<old color> - 0.5)
  • Hue, Saturation and Exposure
    All these operation are done in HSL color space, luminace value is used to simulator exposure. 
    <new color> = convertHSLToRGB( convertRGBToHSL(<old color>) * <hue, saturation, exposure> )
  • Brightness
    <new color> = <old color> + <constant>
  • Color balance
    <new color> = <old color> * <color balance(r,g,b)>
  • Gamma
    <new color> = pow( <old color>, 1/gamma)

Reference:

  1. Color correction on Wiki: 
  2. Color grading on Wiki: 
  3. Using Lookup Tables to Accelerate Color Transformations: 
  4. Brightness, Constrast, Saturation, and Sharpness: 
  5. List of color space and their uses: 
  6. Unreal3 HSV&RGB conversion function: 
  7. Unreal Legacy:Colors: 
  8. NVIDIA shader library(color space operation): 
  9. Optimized RGB to HSL/HSV and HSL/HSV to RGB: 
  10. Color grading in blender: 
  11. Enhancing Photographs in Gimp: 
  12. CLUT: 

转载地址:http://phwqb.baihongyu.com/

你可能感兴趣的文章
Hibernate单向关联N-1
查看>>
Hibernate单向关联1-1
查看>>
jQuery自定义动画
查看>>
Spring-data-redis在shiro中的实例
查看>>
GUN C中__attribute__作用
查看>>
3、系统调用之SYSCALL_DEFINE分析
查看>>
linux的signal_pending及signal
查看>>
OBJDUMP用法
查看>>
c/cplusplus通用makefile
查看>>
JavaScript-密码强度
查看>>
【SSH】1366-InCorrect string value:'\xE9\x99\x88\xE6\x96\xB0...'for column 'name' at row 1
查看>>
SpringCloud前身之微服务
查看>>
纵览全局——SSH
查看>>
Mybatis-略识之无
查看>>
[Vue warn]: Property or method "name" is not defined on the instance but referenced during render
查看>>
ts:json串转换成数组
查看>>
String、StringBuffer和StringBuilder的区别
查看>>
java_选择类排序——简单选择排序
查看>>
java_中介者模式
查看>>
多线程——背景了解
查看>>