What is Gamma Correction? Gamma Correction and linear rendering pipeline

Source: Internet
Author: User

From: http://www.fseraph.com /? P = 434

Those who often play standalone games will surely find that starting last year, basically all new games will have a gamma setting at the beginning. This is mainly because everyone is paying attention to the linear rendering pipeline. In the film industry, color management is a mature technology, and the gaming industry has been popularized in recent years. Next we will briefly explain why we need a linear rendering pipeline and what is Gamma Correction.

1. Gamma Correction

The first thing to note is,Gamma Correction is not designed to compensate the display for nonlinear responses.But there is a deeper reason.

We know that the input voltage of the previously CRT display and the displayed light intensity are non-linear.I=VGamma.

Below are two important curves:

The first figure shows the nonlinear relationship between the input voltage of the CRT display and the displayed brightness (light intensity ).

The second figure shows the nonlinear relationship between brightness perceived by human eyes and light intensity.

Therefore, the human eye is more sensitive to the details of the dark, that is, if we want to quantify the color channel value of a floating point number (Quantization) when the voltage reaches 256 levels (the hardware pixel bit of each color channel is 8 bits), the changes from 9 to 10 are perceptible to the human eye, and the changes from 211 to 212 are as follows, it is imperceptible. Therefore, we should use more bits to encode more important hidden information. This means that the input image should be pre-processed using the curve of the second image, namely power (1/gamma). This process is called Gamma Correction, after the display's power (gamma) output, it is just a linear response curve, so this is actually a trick of early TV design. Or, According to Wikipedia, a combination of luck and engineering which simplified the electronics in early television sets.

2. Why do we need to perform illumination computing in linear space?

The Renderer is linear, and illumination computing also needs to be performed in a linear space. However, if the input diffuse texture is not in a linear space, but in a space that has been calibrated by gamma, then the illumination calculated using these values is linear. Of course there will be problems with the results. General textures are pre-Gamma corrected for correct display. This problem is often overlooked. In standalone games that started from 2011, Everyone began to pay attention to the importance of linear pipelines. Therefore, we can find that, in the first game, players are required to select the appropriate GAMMA value. For example, the Gamma Correction is taken into account on the left side of the graph for illumination in a linear space. Note the abrupt variation of the border between light and shade. This is in line with the physical rules, and the result of illumination in the Gamma space on the right side, the border is gradient, which is actually incorrect. For games that use physical light, the entire rendering pipeline must be linear, otherwise the results will be hard to get together.For better theoretical analysis, we can find it in Jim BlinN's corner: a ghost in snowstorm.

3. How to ensure that the rendering pipeline is linear

Because the rendering pipeline of the new engine is being reconstructed recently, this problem must be solved first. Otherwise, it will be too late to start mass production of art resources.

In general, there are three types of data to consider GAMMA:

  • Various texture textures (such as diffuse, specular, gloss): If the texture is gamma corrected, we can use d3dsamp_srgbtexture to automatically convert the texture to linear space during hardware sampling ( L I "MathJax-Span-21" class = "mi"> n E A r = C O L O r gamma ) To avoid manual computing in the shader, because the basic mainstream graphics cards support this feature, so the speed is very fast. However, some textures may not be SRGB. It depends on the material adjustment requirements.
  • The input color constant of the special shader: the constant is a floating point number, so you can change it to a linear space before passing in.
  • Vertex color to be interpolated: we can save the Gamma color value in the vertex, change it to a linear space in Vs, and then output it to PS using texcoord. In this way, we can use hardware to automatically perform interpolation.

References:

Jim BlinN's corner: What is a pixel, a ghost in snowstorms

Http://www.graphics.cornell.edu /~ Westin/gamma/gamma.html

Http://radsite.lbl.gov/radiance/refer/Notes/gamma.html

Http://http.developer.nvidia.com/GPUGems3/gpugems3_ch24.html

Http://filmicgames.com/archives/299

Http://filmicgames.com/archives/327

Http://en.wikipedia.org/wiki/Gamma_correction

Http://www.poynton.com/notes/color/GammaFQA.html

Related posts:

    1. Sampling and Restoration
    2. Algorithm for generating illumination Graphs-hardware raster-based baking
    3. Blog Summary 1
    4. Technical Analysis of Diablo 3 rendering-tone ing
    5. Notes on basic concepts of graphics

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.