• <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) 閱讀(1655) 評論(1)  編輯 收藏 引用 所屬分類: GraphicsDocuments

            評論

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

            久久综合国产乱子伦精品免费| 精品无码久久久久国产| 精品久久久久中文字| 久久精品免费网站网| 2019久久久高清456| 99999久久久久久亚洲| 国产成人精品综合久久久| 中文字幕无码av激情不卡久久| 精品熟女少妇a∨免费久久| 久久久WWW成人免费毛片| 亚洲午夜久久久久久噜噜噜| 国产精品久久国产精品99盘| 四虎久久影院| 久久99国产一区二区三区| 久久久久AV综合网成人| 亚洲&#228;v永久无码精品天堂久久| 久久精品国产免费观看三人同眠| 嫩草影院久久99| 精品无码久久久久久尤物| 久久人人爽人人爽人人片AV不| 日韩精品久久久久久| 婷婷综合久久中文字幕蜜桃三电影| 99久久婷婷国产综合亚洲| 99精品国产综合久久久久五月天| 久久成人精品| 狠狠精品干练久久久无码中文字幕 | 99久久这里只有精品| 国内精品综合久久久40p| 色8激情欧美成人久久综合电| 国产精品99久久久久久人| 久久精品水蜜桃av综合天堂| 精品久久久久久中文字幕大豆网| 中文字幕无码久久人妻| 深夜久久AAAAA级毛片免费看| 久久午夜无码鲁丝片午夜精品| 久久黄视频| 人妻丰满?V无码久久不卡| 久久精品亚洲福利| 色婷婷综合久久久久中文字幕| 久久免费大片| 狠狠精品久久久无码中文字幕|