POV-Ray : Newsgroups : povray.general : using assumed_gamma of 1.0 ... a discussion : using assumed_gamma of 1.0 ... a discussion Server Time
1 Aug 2024 08:21:26 EDT (-0400)
  using assumed_gamma of 1.0 ... a discussion  
From: Kenneth
Date: 9 Dec 2005 19:10:01
Message: <web.439a1b692d1f46002a1c213f0@news.povray.org>
For creating and viewing a POV scene, on any platform, a correct "composite
gamma," of all the elements of the computer setup and in POV, is the
CORE--the bottom line-- for seeing the scene's brightness levels and colors
"correctly" on screen. Meaning, having them reproduced in a way that best
matches how our eyes see them in the real world.  Simply put, gamma
correction is the overall mechanism by which tonal values on a monitor
screen are "massaged" in order for them to match what our eyes want to see.
(Gamma correction does NOT affect pure white or pure black, only the
intermediate grays.) As part of this, the gamma settings in POV need to be
such as to "trick" the eye into PERCEIVING the correct changes in
brightness levels. A POV scene's assumed_gamma value has a great deal to do
with this.

Should assumed_gamma be set to 1.0?  My own short answer is...no. At least
for Mac and PC users. I realize I'm treading on thin ice here, since
assumed_gamma of 1 has so MANY adherents in the POV community....and POV
itself suggests using it for all newly-created scenes. My reasoning is not
easily described, but here goes...

(BTW, this discussion isn't concerned with setting up POV scenes to render
correctly on others' systems. It's simply for figuring out what the user's
own system should be. Nor does it deal with the gamma-embedding .png file
type.)

As I've mentioned elsewhere, I have both a PC and an older Mac, though I run
POV 3.5.1 strictly in Windows.  I also have versions of Photoshop on both
systems, for comparing images.

Let me reiterate something, in order to drive the point home.
The first place to start with the system's overall (and necessary) gamma
correction is to set the MONITOR's gamma to what it should be.  Since the
world's PCs and the web itself are standardized around a gamma of 2.2, yet
older Macs are standardized around 1.8 (and SGIs at 1.7, so I'm told), I've
chosen 2.0 as the best way to bring my own PC's monitor/operating system
into near-accordance with most everything out there...to view others'
images more or less the way they were intended to be seen, and to produce
images in POV and elsewhere that are likewise. To configure this, I use the
Adobe Gamma control panel app, in conjunction with POV's gamma setup chart.

Once my monitor gamma is set, the next phase is setting POV's display_gamma
in the QUICKRES.INI file. From all I understand in the POV docs, this
should be the same as the monitor (2.0 in my case.)  The POV docs seem
clear about this.

So the only hurdle left is to choose the scene's assumed_gamma.  I've been
using 2.0 so far, as it just seems to reproduce colors, brightness levels
and shadows in a visually pleasing way. But many others choose 1.0, for
various reasons..mostly having to do with working in an "ideal",
undistorted linear color space. But such a render just doesn't LOOK right
to me, and in fact looks distorted, for want of a better word.  (I would be
most interested in knowing which values of monitor gamma and POV's
display_gamma are chosen in order to make that work, as well as which OS
it's being rendered on.)

To do some gamma experiments, I wrote a simple POV scene to display 21 gray
bands, from pure black to pure white, with a "mathematically linear" 5%
change between each band. (That is, the equivalent in POV of increasing the
gray by <.05,.05,.05> each time.) We all assume --don't we?--that POV's
color/brightness values, as used in a typical PIGMENT block, are meant to
reproduce brightness levels such that <.5,.5,.5> represents "half as
perceptually bright as" <1,1,1>.  That's how I write my own scenes, anyway.
(And who wants or needs to deal with picking non-linear values in POV??)
"Half as percepually bright" is subjective, I know.  But rendering a scene
using assumed_gamma of 1 just doesn't LOOK perceptually correct. 50% gray
looks too bright. If the tonal differences in the POV render were subtle,
my concerns wouldn't be important.  But the effect isn't subtle, and I kept
scratching my head about this, wondering what the grays are SUPPOSED to
look like from one step to the next, as it IS a somewhat subjective thing.
I thought of downloading some kind of gray-scale test chart to view
alongside the rendered scene, but discovered two interesting websites
instead, with some very good, possibly definitive gamma info...

http://www.poynton.com

http://www.normankoren.com/makingfineprints1A.html#gammachart

Though complex reading, these sites knowledgeably and thoroughly describe
linear vs. non-linear reproduction of brightness levels, and how our eyes
(and computer monitors) relate to them. Which got me to thinking that
assumed_gamma of 1 may be causing POV to render simple "linear" brightness
changes in a way that "defeats" some (or all) of the necessary
NON-linearity (i.e., gamma correction) that the overall system is trying to
impose (in order to render brightness levels the way the human eye responds
to them--and why, in the first place, Macs and PCs impose their own gamma
corrections on top of the monitor's "raw" gamma of 2.5)

But back to my own case. IF using assumed_gamma of 1 (along with
display_gamma of 2 and monitor gamma of 2) does in fact render a simple
"linear" reproduction of brightness levels, then my system's 2.0 gamma is
not reproducing them correctly, and the "use assumed_gamma of 1" theory
seems...flawed...at least as it's described in the POV docs. The
assumed_gamma value needs to be chosen to force POV's simple, linear values
to render more perceptually correct...creating tonal values that visually
"match" what we're all used to seeing in the real world.

Here's my "linear" gray-bar test scene, applied to a plane and a box...

// POV ver. 3.5.1

global_settings{assumed_gamma 1.0}

camera {
  perspective
  location  <.9, 6, -10>
  look_at   <.9, 0, 0>
  right     x*image_width/image_height
  angle 25
            }


#declare grey_bands =
                color_map{
                        [0.0 rgb 0]
                        [0.0476 rgb 0]
                        [0.0476 rgb .05]
                        [0.0952 rgb .05]
                        [0.0952 rgb .1]
                        [0.1429 rgb .1]
                        [0.1429 rgb .15]
                        [0.1905 rgb .15]
                        [0.1905 rgb .2]
                        [0.2381 rgb .2]
                        [0.2381 rgb .25]
                        [0.2857 rgb .25]
                        [0.2857 rgb .3]
                        [0.3333 rgb .3]
                        [0.3333 rgb .35]
                        [0.3810 rgb .35]
                        [0.3810 rgb .4]
                        [0.4286 rgb .4]
                        [0.4286 rgb .45]
                        [0.4762 rgb .45]
                        [0.4762 rgb .5]
                        [0.5238 rgb .5]
                        [0.5238 rgb .55]
                        [0.5714 rgb .55]
                        [0.5714 rgb .6]
                        [0.6190 rgb .6]
                        [0.6190 rgb .65]
                        [0.6666 rgb .65]
                        [0.6666 rgb .7]
                        [0.7143 rgb .7]
                        [0.7143 rgb .75]
                        [0.7619 rgb .75]
                        [0.7619 rgb .8]
                        [0.8095 rgb .8]
                        [0.8095 rgb .85]
                        [0.8571 rgb .85]
                        [0.8571 rgb .9]
                        [0.9048 rgb .9]
                        [0.9048 rgb .95]
                        [0.9524 rgb .95]
                        [0.9524 rgb 1.0]
                        [1.0 rgb 1.0]
                                    }

// ---------------

plane {y, 0
        texture{
                pigment{
                        gradient x
                        color_map{grey_bands}
                        scale <4.5,1,1>
                        translate -1.4*x
                            }
                finish{
                        ambient 1
                        diffuse 0
                        }
                   }
        }



// cube
object{
     box{0,1
        texture{
                pigment{
                        gradient x
                        color_map{grey_bands}
                            }
        finish{
                ambient 1
                diffuse 0
                }
                   }
            }
           scale 1.4
           translate <.2,.5,-3>
         }


I would be interested in knowing what other POV users see, running this
test.  On my own system, using assumed_gamma of 1, the brighter grays
appear to have too many levels (i.e., small visual differences between
values, and with more bands, spread further across the chart.) The dark
gray bands, especially near black, have too few levels (i.e., greater
differences between values, and "compressed" into a smaller space).
Basically, a much more abrupt perceptual change from black up to the first
dark gray, than from white down to the first bright gray. Lowering
assumed_gamma even further, in small increments, exaggerates this effect.
Norman Koren's website has a similar gray-band chart and describes in more
detail what happens. Simply put: Across all 256 (8-bit) gray steps that POV
can typically produce--a continuous gray scale--the darker grays are
"compressed" and the lighter grays "expanded."  The overall system is thus
giving "unequal visual weight" to the lighter grays. When looking extremely
close-up at such a continuous spread, where you can see the individual
steps in brightness, the light gray steps are actually wider, the dark gray
steps narrower. Ideally--from a visual standpoint-- the steps should be
"equal" in size across the entire spectrum. This isn't the case when using
assumed_gamma of 1.  So in a typical POV scene, the brighter colors and
grays will appear somewhat washed-out.

A Kodak "photographic gray card" -- neutral gray, in other words-- has an
actual reflectance of only 18% (not 50% as would be assumed.) This
corresponds to a PERCEPTUAL brightness of "half as bright as white,"
whether viewed with the eye or by photographic film.  As Poynton says in
his gamma discussion, "A source having a luminance of 18% of a reference
luminance will appear half as bright." This is the human eye's PERCEPTUAL
response to luminance....which isn't linear.  A POV-generated gray value of
<.5,.5,.5>, applied to an object with finish{ambient 1 diffuse 0}, should,
it seems to me, reproduce on screen in the same way...half as PERCEPTUALLY
bright as (POV) white.  "Raw" monitor gamma/OS
gamma/display_gamma/assumed_gamma all contribute to make that a reality, of
course. So POV's assumed_gamma must be chosen to take that POV <.5,.5,.5>
gray and place it squarely in the "middle" of our PERCEPTION of
black-to-white.

SO...what should assumed_gamma be, for POV to produce--and the eye to
perceive -- "equally weighted" brightness changes in a rendered POV scene?
On my own system, with both monitor gamma and display_gamma set at 2.0, a
value of from 1.8 to 2.0 *seems* to be the right choice...confirming what I
had always been using. Although I have no absolute, foolproof way of
knowing if what I'm seeing is correct, a numerically identical gray-band
chart I created in Photoshop on my PC, and viewed there, EXACTLY matches my
POV render using assumed_gamma of 2.0 (Is the Photoshop test itself
displaying "perceptually equal" grays? Can't say that I really know for
sure, short of attempting to compare the screen image to an accurate
physical gray-scale test chart. But this is the same Photoshop that always
displays digital photos and all other images "correctly" to my eyes.)

The only other test I could think of was this: I rendered two versions of my
POV gray-band scene (both with display_gamma set at 2.0.)--- one with
assumed_gamma of 2.0 and one with 1.0  Both were output as .bmp files so as
not to include any embedded gamma correction, and brought up in Photoshop
(on BOTH of my computer systems.) PS's eyedropper tool was used to measure
the brightness levels of each gray band in both images. The values in the
assumed_gamma 2.0 image EXACTLY match their counterparts in the Photoshop
test (that is, exact 5% increments.) The values in the assumed_gamma 1.0
image are definitely "distorted." (In fact, between pure black and the next
lighter band, there is a 19% difference instead of 5%!)

Interestingly, my PS test chart image, viewed in PS on the PC but with the
middle LEVELS slider changed from 1.0 to 2.0 (which is actually a gamma
adjuster), forces it into almost EXACT numerical and visual accordance with
the "distorted," assumed_gamma 1.0  POV render! Doing the reverse--bringing
the distorted POV image up in PS and adjusting the LEVELS to .5 (.5 being
the inverse of 2.0) brings that image into PERFECTLY exact accordance with
the "correct" PS test image!

Another important point: Leaving my monitor gamma at 2.0 and making POV's
display_gamma and assumed_gamma BOTH 1.0, does display the POV-generated
gray bands in a "perceptually equal" way (in PS as well.) Which also shows
that monitor gamma and display_gamma don't have to match. The POV docs make
no mention of these little tidbits, AFAIK... and I wish they did!! Perhaps
this is what the POV docs meant all along??

A little aside: POV's gamma test chart simply shows what your monitor gamma
is...and usually agrees fairly well with it. But setting your monitor's
"black level" (using it's BRIGHTNESS control) is important for getting the
monitor to display a truly correct gamma. This is touched on in the POV
docs but doesn't explain it well. By adjusting brightness, you can "tweak"
the gamma of the monitor to EXACTLY match the chart.


Post a reply to this message

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