POV-Ray : Newsgroups : povray.beta-test : Struggling with gamma... : Re: Struggling with gamma... Server Time
2 Jul 2024 10:22:25 EDT (-0400)
  Re: Struggling with gamma...  
From: clipka
Date: 28 Jun 2010 18:06:15
Message: <4c291cd7$1@news.povray.org>
Am 28.06.2010 23:17, schrieb Gyscos:

> About gamma, File_Gamma is supposed to compensate for the eye's non-linear
> perception. But why do we need to do this ?... Shouldn't the eye do it itself ?

It's not about the non-linear perception /per se/, but about the eye's 
non-linearity in how good it can tell apart different brightness levels: 
For the same given absolute brightness difference, the human eye can 
tell apart two dark colors easier than two bright colors.

As a consequence, color banding due to limited bit depth is much more of 
a problem in dark areas than in bright ones; with a straightforward 
linear encoding, a bit depth of 8 would be more than enough for the 
bright colors, while being still insufficient for dark colors.

This is circumvented by using a non-linear encoding ("gamma encoding") 
in the image files, so that the discrete brightness levels that can be 
encoded are /perceptually/ distributed evenly among both dark and bright 
colors. For instance, the brightness levels encoded with values 16 and 
17 can be told apart about as easily as the brightness levels encoded 
with values 239 and 240, or those encoded with values 127 and 128.

This gamma encoding is what File_Gamma controls.

Of course, if a file is gamma-encoded this way, that very same encoding 
must be reverted in one way or the other. The traditional way was to use 
a gamma encoding that matched the intended target system's display 
gamma, so that essentially the gamma decoding would be performed by the 
hardware; or, seen from a different perspective, the gamma encoding 
would serve as gamma pre-correction for the target display.

On the other hand, the modern way - as used e.g. in the PNG file format 
- is to (theoretically) de-couple the two concepts of gamma encoding and 
gamma pre-correction: In a first step, the viewing software will 
gamma-decode the image to reconstruct the linear brightness values, and 
in a second step gamma pre-correct these linear brightness values to 
compensate for the display's non-linearity. (In practice both steps may 
be combined, and this /may/ even result in a "nothing to do" operation, 
but that's just a special case now, and software must no longer take 
that for granted.)


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.