POV-Ray : Newsgroups : povray.advanced-users : rgb vs srgb : Re: rgb vs srgb Server Time
28 Sep 2024 18:57:03 EDT (-0400)
  Re: rgb vs srgb  
From: Warp
Date: 11 Sep 2011 07:40:12
Message: <4e6c9e1b@news.povray.org>
Ive <ive### [at] lilysoftorg> wrote:
> Am 11.09.2011 10:14, schrieb Thomas de Groot:

> >> If you want the color<213, 127, 79>/255 to correspond to the on-screen
> >> pixel value<213, 127, 79>, you'll have to use an assumed_gamma of 2.2
> >> (which is the default).
> >>
> Nonsense!

  It isn't. This is actually very easy to verify. Just use a very simple
scene like this:

    global_settings { assumed_gamma 2.2 }
    background { rgb <213, 127, 79>/255 }

  When I rendered that, the image file ended up full of pixels with the
value (214, 128, 78) (granted, not *exactly* the original values, but a
difference of one isn't exactly large, and accounted for by rounding errors).

  In contrast this:

    global_settings { assumed_gamma 1.0 }
    background { rgb <213, 127, 79>/255 }

produces an image full of pixels with the value (253, 187, 151).

  Gamma correction is a bit wonky like that.

> > Display_Gamma = sRGB
> > global_settings {assumed_gamma 1.0}
> >
> Yes. Thats definitely how it should be when you are aiming for a 
> (photo)realistic render.

  It's just that if you do that, you'll have to pre-gamma-correct all your
input colors if you are choosing them from an external program. The external
program will use raw pixel values, and they will have to be pre-gamma-corrected
with the gamma factor 2.2 if you want them to look the same in povray with an
assumed gamma of 1.0.

  Also, linear gradients won't look linear (at least not currently).
(They are linear in terms of the energy they emit, but not in their
perceived brightness.) This can be a bit of a problem when designing
textures which should have a certain *look*, rather than having a certain
emission function. (The relationship between emitted energy and perceived
brightness is roughly logarithmic, and the exponent is approximately 2.2,
which happens to coincide with most displays.)

> Don't do this. Actually this isn't a complicated matter. What makes it 
> appear complicated is the amount of wrong informations and even worse 
> half true statements as sadly frequently given within this newsgroup.

  It *is* a complicated subject, and there indeed is a lot of misinformation
out there. A common misunderstanding is the relationship between absolute
brightness (the amount of energy that a pixel with a certain value emits,
mesured in watts) and the *perceived* brightness (which is what it looks
like to the human eye). This relationship is far from linear.

  The question is: Do you want "rgb 0.5" to emit half of the energy than
"rgb 1.0" (in which case you should use assumed_gamma 1.0), or do you want
"rgb 0.5" to *look* half as bright as "rgb 1.0" (in which case you should
use assumed_gamma 2.2)?

  You can make "0.5" to look half-gray even with an assumed_gamma of 1.0
by pre-gamma-correcting it (in which case you would have to use
pow(0.5, 2.2) = 0.218), and in theory all the surface lighting will be
more accurate (because they will deal with the absolute light energy,
rather than perceived brightness), but as said, you will stumble across
problems when designing textures (eg. because linear gradients won't look
linear) and other such things related to colors.

-- 
                                                          - Warp


Post a reply to this message

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