POV-Ray : Newsgroups : povray.general : using assumed_gamma of 1.0 ... a discussion : Re: using assumed_gamma of 1.0 ... a discussion Server Time
1 Aug 2024 14:26:40 EDT (-0400)
  Re: using assumed_gamma of 1.0 ... a discussion  
From: Christian Walther
Date: 29 Dec 2005 06:20:14
Message: <43b3c66e@news.povray.org>
Kenneth wrote:
> If my monitor/OS
> gamma is set to 2.0 (or even 2.2), and I use assumed_gamma of 1.0 as
> recommended, what happens to POV's lighting calculations if I set
> display_gamma to 1.0 as well?

Nothing happens to the lighting calculations (they're done with the 
numbers you specify in the scene file, which are assumed to be 
linear-to-intensity, as always). What changes is that you end up with an 
output file that's encoded with a gamma of 1.0 (i.e. stores 
linear-to-intensity values). There are two problems with that if you are 
interested in physically faithful reproduction (which, as far as I 
understand, you *aren't*):

o 8-bit sampling (256 different intensity values) is too coarse for 
linear samples, you'll clearly see color banding in the dark areas if 
you display such a file correctly (as follows).

o you need to use a file format that stores the gamma value (only PNG at 
this time) and a viewer application that honors this value and 
transforms the values read from the file from gamma-1.0-encoded to 
gamma-2.0-encoded before sending them to video memory. (Unfortunately 
most applications don't do that.)

> Such a set-up actually produces the visual results I like to see.

I presume it produces these results when you're *not* following the 
second point above. What happens in that case is that you darken the 
midtones of the image by encoding the image with a gamma of 1.0, then 
interpreting it as if it was encoded with a gamma of 2.0. Whether that 
qualifies as "abuse" is debatable. I'd say yes, but it has one advantage 
over the "non-abusive" way, rendering the image correctly and then 
darkening it in Photoshop: less rounding error because rounding is only 
done once, not twice.

If you're only publishing the final image and not the scene file, it 
doesn't matter anyway.

> But if I do this, is POV still able to calculate
> things the way it's designed to (since assumed_gamma is 1.0)? Or am I still
> introducing "gamma abuse" into those calculations? It would *seem* not,
> since as I understand matters, display_gamma is only concerned with the
> "output" end of POV. But I could be wrong.

assumed_gamma only affects the output end, too. In fact, unless you're 
using an output file format that stores display_gamma (i.e. PNG), 
there's no difference at all between changing assumed_gamma and changing 
display_gamma, as the only place they're ever used is in their quotient 
(someone correct me if I'm wrong). That's why (assumed_gamma = 2.0, 
display_gamma = 2.0) and (assumed_gamma = 1.0, display_gamma = 1.0) 
produce the same images (that are physically too dark but seem visually 
right to you).

What's bad ("bad" in the sense of "bad if a physically accurate lighting 
simulation is desired") about a display_gamma/assumed_gamma quotient 
different from your real display gamma is that it tempts you to specify 
non-linear-to-intensity numbers in the scene file (by producing 
seemingly normal images with them). That's not what the lighting 
calculations expect, and there's no way in the current POV-Ray to change 
that. (As I already mentioned, I believe assumed_gamma was originally 
intended as such a way, but it just doesn't work that way.)

If both of the conditions "display_gamma/assumed_gamma = actual display 
gamma" (to make you input linear-to-intensity numbers, which leads to 
correct lighting) and "display_gamma = actual display gamma" (to store 
the correct value in PNG files) are to be satisfied, the only solution 
is "assumed_gamma = 1, display_gamma = actual display gamma".


But I'm already talking way too much again. :) It's clear that what you 
are aiming for is not physically correct lighting, and you just have to 
accept the fact that there's no "non-abusive" way of achieving that in 
the current POV-Ray. There are actually many features in POV-Ray that 
are specifically meant for non-physically-motivated artistic purposes, 
but there is none for what you want (there may be one in MegaPOV, I 
haven't followed recent developments there). The assumed_gamma / 
display_gamma features may do what you want, but it's not what they're 
intended for.

  -Christian


Post a reply to this message

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