• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            黎明的剔透里伸出了你沁清的曖昧

            Graphics|EngineDev|GameDev|2D&3D Art

              C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
              60 隨筆 :: 1 文章 :: 18 評論 :: 0 Trackbacks


            image

            在計算機圖形學領域時常聽到gamma correction ,gamma correction 控制了圖像整體的亮度,reproduce colors也需要gamma correction的一些理論知識,gamma correction不僅僅是控制了圖像的亮度,而且還控制了RGB各個分量的比例,我們知道渲染器是線性的,而顯示器并非線性,其實電子打在屏幕上從而產生亮點,電子的運動受電壓控制,這兩者是指數關系的,所以產生的亮度也跟電壓成指數關系,而發送給顯示器的voltages范圍是0~1:

            image

            image

            對于我們輸入的圖像,如果直接顯示,那么就會篇暗,根據已知電壓與顯示亮度的關系,進行gamma correction ,其實就是對gamma曲線的修正。一般生產廠家不加說明,他們的伽碼值大約等于2.5.

            image

            image

            代碼:

               gammaCorrection = 1 / gamma
               colour = GetPixelColour(x, y)
               newRed   = 255 * (Red(colour)   / 255) ^ gammaCorrection
               newGreen = 255 * (Green(colour) / 255) ^ gammaCorrection
               newBlue  = 255 * (Blue(colour)  / 255) ^ gammaCorrection
               PutPixelColour(x, y) = RGB(newRed, newGreen, newBlue)

            知道monitor不是一個線性的,那么我們在進行顏色加法時,我們得到的顏色并不是真正的顏色值的相加,比如gamma factor是2.2

            red = add (r1, r2);

            red= add (0.235,0.156);

            對于一個線性設備,red = 0.391,對于未經修正的montior red=0.126;

            因為有一個冪函數的運算:C_out = C_in2.2

            現在使用gamma correction :C_corrected= C_out1.0/2.2

            0.3912.2 = 0.126

            0.1261.0/2.2 = 0.39

            我們看到使用伽碼校正以后我們能得到我們預想的顏色值0.39.

             

            imageimage

             

            imageimage

             

            imageimage

             

             

            There are two ways to do gamma correction:

            • Using the renderer. The renderer (the graphics card or GPU) is a linear device. Modern renderers have the support of gamma correction via sRGB textures and framebuffer formats. See the following OpenGL extensions for more details: GL_ARB_framebuffer_sRGB and GL_EXT_texture_sRGB. With these extensions you can get gamma corrected values for free but gamma correction factor is set to 2.2. You can’t change it.
            • Using a software gamma correction. The gamma correction is applied to the final scene buffer thanks to apixel shader and you can set the gamma correction you want.

            In OpenGL, using GL_ARB_framebuffer_sRGB is really simple: once your FBO is bound, just enable the sRGB space with

            glEnable(GL_FRAMEBUFFER_SRGB);
             
            gamma-correction
            posted on 2012-11-15 23:05 情絕格調(fresmaster) 閱讀(1654) 評論(1)  編輯 收藏 引用 所屬分類: GraphicsDocuments

            評論

            # re: Gamma Correction 2014-07-09 11:35 tzzhwj
            謝謝你的勞動  回復  更多評論
              

            久久一区二区三区99| 国产精品99精品久久免费| 久久免费视频6| 伊人久久大香线焦AV综合影院| 久久久精品久久久久影院| 久久久久亚洲av无码专区| 91久久香蕉国产熟女线看| 久久夜色精品国产亚洲| 久久无码人妻一区二区三区 | 国产免费久久精品99久久| 94久久国产乱子伦精品免费| 一级女性全黄久久生活片免费| 亚洲AV日韩AV天堂久久| 国内精品久久久久久中文字幕| 亚洲va中文字幕无码久久不卡| 精品久久久久久无码中文野结衣| 亚洲中文字幕无码久久精品1| segui久久国产精品| 国产亚洲精品自在久久| 久久久久亚洲AV无码专区首JN| 一本大道久久a久久精品综合| 中文国产成人精品久久不卡| 国产精久久一区二区三区| 久久天天躁狠狠躁夜夜avapp | 久久久久婷婷| 亚洲国产精久久久久久久| 无码精品久久久久久人妻中字| 青青久久精品国产免费看| 精品久久久久久久久久久久久久久| 无码国产69精品久久久久网站| 色青青草原桃花久久综合| 午夜精品久久久久久影视777| 国内精品久久久久影院网站| 93精91精品国产综合久久香蕉| 97久久香蕉国产线看观看| 久久精品国产亚洲av高清漫画| 久久久久久综合网天天| 亚洲人成伊人成综合网久久久 | 好属妞这里只有精品久久| 国产成人精品久久二区二区| 99国产欧美精品久久久蜜芽|