POV-Ray : Newsgroups : povray.beta-test : Gamma tutorial for the 3.7 documentation? Server Time
6 Jul 2024 05:28:47 EDT (-0400)
  Gamma tutorial for the 3.7 documentation? (Message 26 to 35 of 35)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Nicolas Alvarez
Subject: Re: Gamma tutorial for the 3.7 documentation?
Date: 17 Oct 2009 19:17:53
Message: <4ada50a1@news.povray.org>
"Sven Geier" <.sven.at.sgeier.dot.net.nospamplease> wrote:
> Why do I have to futz around with ini files (and make the same change
> every single time a new beta comes out because the old ini files get
> replaced with the new ones every time) just to get the behaviour that one
> would expect for a run-of-the-mill PC?

Because it's a beta, maybe?

If you don't want to futz around with that kind of things, use a final
release version.


Post a reply to this message

From: Robert McGregor
Subject: Re: Gamma tutorial for the 3.7 documentation?
Date: 3 Nov 2009 21:40:01
Message: <web.4af0e8efe70cefa24726e92b0@news.povray.org>
Okay, I see I've stumbled onto this discussion a couple months late, but only
because of the linear 1.0 gamma issues I *thought* I was having recently. So I
started searching the groups for gamma topics and here it is.

Anyway, I've been reading for hours online about the gamma issue and I now
realize the problems I've been seeing are related to my new 26 in. LCD monitor
and video card, not POV-Ray 3.7 per-se (and since I only recently actually
started using the beta consistently, it was just bad synchronicity). I finally
located the gamma correction utility in my NVidea control panel and got that
sorted (doh!).

Now my only real issue is with gamma pre-correction on my image map files (so
v3.7's linear 1.0 rendering and post file_gamma correction don't wash out my
image maps). I'd like to be able to simply tell POV-Ray to gamma pre-correct my
input images as needed by using some simple math, say 1.0 divided by display
gamma, something like:

image_map { jpeg "myfile" pre_gamma 1/2.2 }

Then when using any PNGs with embedded gamma I could skip that (or just use
pre_gamma 1)

Is that anything like what's planned/coming in the future?

(And thanks for bearing with me on this gamma issue everyone - I needed to
educate myself a bit on this topic - never really considered it much until very
recently)

-Rob


Post a reply to this message

From: clipka
Subject: Re: Gamma tutorial for the 3.7 documentation?
Date: 3 Nov 2009 22:45:18
Message: <4af0f8ce$1@news.povray.org>
Robert McGregor schrieb:

> Now my only real issue is with gamma pre-correction on my image map files (so
> v3.7's linear 1.0 rendering and post file_gamma correction don't wash out my
> image maps). I'd like to be able to simply tell POV-Ray to gamma pre-correct my
> input images as needed by using some simple math, say 1.0 divided by display
> gamma, something like:
> 
> image_map { jpeg "myfile" pre_gamma 1/2.2 }
> 
> Then when using any PNGs with embedded gamma I could skip that (or just use
> pre_gamma 1)
> 
> Is that anything like what's planned/coming in the future?

Yes, definitely. As a matter of fact, a corresponding patch has been 
implemented already, and I expect it to feature in the next beta.

The syntax will differ in some details of course; for instance, the 
keyword is likely to be "file_gamma" and the parameter value will 
actually be the inverse of your proposal; it will also be conceptually 
an override, not an additional adjustment, which will make a difference 
for PNG files; e.g. if a PNG file is encoded pre-corrected for a display 
gamma of 2.2, and "file_gamma 2.2" is specified, POV-Ray will still 
apply a total gamma adjustment of x^2.2, not x^(2.2*2.2).


> (And thanks for bearing with me on this gamma issue everyone - I needed to
> educate myself a bit on this topic - never really considered it much until very
> recently)

I guess you're not the only one. I didn't wrap my head around it in a 
single day either.


Post a reply to this message

From: Sven Geier
Subject: Re: Gamma tutorial for the 3.7 documentation?
Date: 4 Nov 2009 15:45:00
Message: <web.4af1e75ee70cefa25b4449250@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:

> [a number of interesting things]

I have to say: If the value of a message is measured by the amount of thinking
it inspires, then this was one of the most valuable messages I've seen on the
Internet in a while. After quite a bit of pondering, this is the most coherent
answer I can come up with.

Let me start here:

>Gamma correction is about how your *input* values are mapped to the
>output values. In other words, when in the *input* you say "I want 50%
>gray", gamma correction tells the program what it should write to the
>output image in order to get 50% gray.
>
> Gamma correction is also about telling in the image data that "this
>should be interpreted as 50% gray" so that if you view the image in a
>different system with a different display hardware with different gamma,
>that color will look like 50% gray there as well, and not eg. 40% or 60%
>gray.

I think these two paragraphs sum up a bit of a conflict: is gamma about the
input or the output? If you say that it specifies how I want a pixel to appear
on the screen, then it sure looks like it is a post-processing step after the
color of the pixel has already been computed in the linear rgb space. An
afterthought, if you will, to take care of the different output devices this
pixel might be displayed on. Which is in conflict with the claim that it is
about input conversion.

At this point, it might actually be nice to have a clear "mission statement"
that actually tells us what purpose all the futzing with gamma in POV is
actually supposed to have. Input? Output? Both? Some high-level declaration
against which we can measure any one change that is occuring: "does *this*
change really serve *that* purpose?"

But the real beef, the part that really made me think, was this innocent little
question:

>  If you specify "50% gray" in your scene file, and the end result is not
>50% gray on your screen, is that how you wanted it to work? Because that's
>how POV-Ray 3.6 works.

I had never really thought much about it, but I actually think *about POV-Ray*
in two different (sometimes incompatible) ways.

On the one side, I think of it in terms of physics. Photons interacting with
surfaces, watts per square meter per steradian emitted in certain given spectral
bands and then absorbed somewhere else. Diffraction, illumination, scattering.
All the wonderful bits of math involved. Conservation of energy. That kind of
thing.

From this perspective, your question up there doesn't make much sense: a
specification of "rgb 0.5" in my scene file is about the reality of a given
object, namely that it emits half as many watts per area into some solid angle
(given by things like specularity) as it received. This specification is
completely unrelated to any kind of output device - an object specified as "50%
grey" can appear on any one monitor as any one color, depending on the
illumination of that surface by light sources and other surfaces and by the
angle to and distance from the camera.

Heck, even if there is no camera at all. The object is still specified as "50%
grey" and that is still a property of the object and this "50% grey"-ness
influences how it reflects light onto other things even if the camera points in
the opposite direction. Whether this object is ever taken into account in the
creation of any one image depends on its geometric relationship with its
environment and the direction in which any one camera might be pointed. And if
it is in view in any one image, then it can appear on my screen as anything from
pitch black to pure white and anything in between, depending on the actual
illumination conditions.

The other perspective I have on POV-Ray is about art. A tool to make pretty
images. Here I care about composition, lighting, shapes, structure, texture etc.
The physical background goes away entirely.

I might look at a scene and say: "That thing there looks too dark compared to
what I am trying to achieve. I'd like to make it a little lighter". In this
context, I could not care less what *number* there is attached to any one
specification - like the "rgb ..." value in some pigment. If I want it lighter,
I might increase it. Until it looks right. Or do something completely different
like increase "ambient" or such.

What I am concerned about there is the actual pixels on my screen, the image
that is being created - and all the vectors and color specs and whatnot become
mere utilities to that end. I want a grey that "looks a little lighter than that
and a shade colder" and from an artistic perspective I know I can make it a
little colder by making it a little bluer which I can achieve by raising the
blue component in my "ambient" statement and voila: I have changed the
appearance of an object even though its pigment is still specified as "rgb 0.5".
Or maybe "rgb 0.1" or "rgb 5.7". Or whatever I may have tinkered with to make
something *look* right.

From this perspective your question doesn't make much sense either - if I want
50% grey then there's a million buttons to turn and very rarely will there
happen to be a number "0.5" in there somewhere. Maybe the object is specified as
"0.7" and with a negative ambient illumination or something weird like that -
because it served some artistic purpose elsewhere.

All this said, here's my take on your question:

>  If you specify "50% gray" in your scene file, and the end result is not
>50% gray on your screen, is that how you wanted it to work?

If I specify "50% gray" in a scene file and there happens to be a pixel on my
screen that happens to come out 50% gray, then this would be mere coincidence.
It's not that I "want" it to come out differently, but it sure isn't like I
"wanted" it to come out this way either. From a physics perspective the "50%
grey" in the input is the reality and the resulting image (if any) is just
incidental to that reality and carries the properties of my camera and my light
sources in it - and from an arts perspective the image is all there is to it and
whether any of the numbers that entered into making the image happens to be
"0.5" or "128" or or "#808080" or "374629.4432" makes no difference to the end
result.

All that said - my preferred way of looking at POV-Ray is from an arts
perspective. I'm a physicist and if I have a situation where I really care about
the reality of the light propagation I'll run Zemax or Code-V; POV-Ray doesn't
cut it there. It's a toy, in the end.

And from an arts perspective, the recent betas of 3.7 have produced results that
looked like foot. But looked a lot better if I take them individually into a
paint program after the fact - and reduce gamma by about ~50%.

Am I the only one who looks at things this way? Who is the target audience here,
really? And what do they want and think? I am honestly curious.


Post a reply to this message

From: Warp
Subject: Re: Gamma tutorial for the 3.7 documentation?
Date: 4 Nov 2009 17:39:20
Message: <4af20298@news.povray.org>
Sven Geier <.sven.at.sgeier.dot.net.nospamplease> wrote:
> >Gamma correction is about how your *input* values are mapped to the
> >output values. In other words, when in the *input* you say "I want 50%
> >gray", gamma correction tells the program what it should write to the
> >output image in order to get 50% gray.
> >
> > Gamma correction is also about telling in the image data that "this
> >should be interpreted as 50% gray" so that if you view the image in a
> >different system with a different display hardware with different gamma,
> >that color will look like 50% gray there as well, and not eg. 40% or 60%
> >gray.

> I think these two paragraphs sum up a bit of a conflict: is gamma about the
> input or the output?

  It's related to mapping input values to output values. Input values are
abstract, for example "50% gray", while output values are concrete pixel
values which will show up on your screen. What the gamma value does is to
tell the hardware how to convert the input values so that they will show
up on screen correctly. This is needed because different hardwares have
different mappings between input and output.

  Most programs don't care about this mapping and skip gamma correction
altogether. In these programs if you specify, for example "50% gray", what
you will get is a pixel with color components which are exactly in the
middle of the color component range (eg. on a 24 bits-per-pixel display
it will result in a pixel with values 127,127,127). That will not produce
a 50% gray with most monitors. However, people are so used to this that
they don't even notice that the mapping is incorrect.

  POV-Ray 3.6 is, basically, such a program. POV-Ray 3.7 wants to change
that and abstract the meaning of color definitions so that "rgb 0.5" really
means "50% gray" and not "whatever your monitor will show when you use a
pixel value of 127,127,127". A proper gamma setting is the tool for that.

> If you say that it specifies how I want a pixel to appear
> on the screen, then it sure looks like it is a post-processing step after the
> color of the pixel has already been computed in the linear rgb space.

  "Post-processing" is a change done to the pixel after it has been rendered
and before it's written to the image file (or previewed on screen). Gamma
correction goes beyond that (at least for image file formats which support
gamma information): It also writes to the file information which an image
viewing program can use to correct the pixels properly before showing them
on a different hardware with a different gamma than the computer where the
image was created. This means that in different computers, with different
gamma correction settings, what ends up being sent to the display hardware
may be different pixel values, with the goal that what you see on screen
will end up looking the same (rather than darker or lighter than in the
original computer).

> An
> afterthought, if you will, to take care of the different output devices this
> pixel might be displayed on. Which is in conflict with the claim that it is
> about input conversion.

  It is about input conversion in the sense that the original data (eg. in
this case an SDL scene file) had for example "50% gray", and the gamma value
is used during the entire process of rendering and displaying in order to
make sure that it will look like "50% gray" on the screen as well. Without
this gamma correction it won't look like that.

> From this perspective, your question up there doesn't make much sense: a
> specification of "rgb 0.5" in my scene file is about the reality of a given
> object, namely that it emits half as many watts per area into some solid angle
> (given by things like specularity) as it received. This specification is
> completely unrelated to any kind of output device - an object specified as "50%
> grey" can appear on any one monitor as any one color, depending on the
> illumination of that surface by light sources and other surfaces and by the
> angle to and distance from the camera.

  Of course lighting will affect how the color ends up on the final image.
However, gamma correction makes sure that the end result will be proper,
according to the math. For example if a 50% gray color is dimmed by lighting
by half, then you want a 25% gray to show up on screen, not something else.
And gamma correction is the tool for that. Without gamma correction you won't
get 25% gray.

> The other perspective I have on POV-Ray is about art. A tool to make pretty
> images. Here I care about composition, lighting, shapes, structure, texture etc.
> The physical background goes away entirely.

> I might look at a scene and say: "That thing there looks too dark compared to
> what I am trying to achieve. I'd like to make it a little lighter". In this
> context, I could not care less what *number* there is attached to any one
> specification - like the "rgb ..." value in some pigment. If I want it lighter,
> I might increase it. Until it looks right. Or do something completely different
> like increase "ambient" or such.

  Wouldn't you want for the image to look the same in someone else's computer
as it does in yours?

  Improper (or lack of) gamma correction will not only change the brightness
of the colors, but also their hue (because if different color components have
different values, they will be affected non-linearly by the display hardware;
this means that a pixel value of eg. 192,128,64 will have a slightly different
hue with different display hardwares).

  So gamma correction *does* make a difference even from an artistic point
of view.

-- 
                                                          - Warp


Post a reply to this message

From: clipka
Subject: Re: Gamma tutorial for the 3.7 documentation?
Date: 4 Nov 2009 18:10:49
Message: <4af209f9@news.povray.org>
Sven Geier schrieb:

> At this point, it might actually be nice to have a clear "mission statement"
> that actually tells us what purpose all the futzing with gamma in POV is
> actually supposed to have. Input? Output? Both? Some high-level declaration
> against which we can measure any one change that is occuring: "does *this*
> change really serve *that* purpose?"

It's actually about in- /and/ output.

For output, it is about converting from linear light intensity values to 
whatever it takes to make the CRT or LCD display generate just exactly 
that light intensity.

For input, it is about converting e.g. texture images that /already/ 
have undergone such a conversion process (or individual colors "picked" 
from such an image), back to linear light intensity values as needed to 
properly perform the raytracing computations.

Voila.

The current settings


>>  If you specify "50% gray" in your scene file, and the end result is not
>> 50% gray on your screen, is that how you wanted it to work? Because that's
>> how POV-Ray 3.6 works.
> ...
> On the one side, I think of it in terms of physics. Photons interacting with
> surfaces, watts per square meter per steradian emitted in certain given spectral
> bands and then absorbed somewhere else. Diffraction, illumination, scattering.
> All the wonderful bits of math involved. Conservation of energy. That kind of
> thing.
> 
> From this perspective, your question up there doesn't make much sense: a
> specification of "rgb 0.5" in my scene file is about the reality of a given
> object, namely that it emits half as many watts per area into some solid angle
> (given by things like specularity) as it received. This specification is
> completely unrelated to any kind of output device - an object specified as "50%
> grey" can appear on any one monitor as any one color, depending on the
> illumination of that surface by light sources and other surfaces and by the
> angle to and distance from the camera.

Let me rephrase Warp's question a bit:

If you specify an object with a checkered pattern, colored as "50% grey" 
and "100% grey" (i.e. white) - how do you expect the "50% grey" squares 
of the object to appear /in relation to/ the adjacent white squares?

If you specify two spotlights, with brightness of "rgb 1.0" and "rgb 
0.5", illuminating a uniformly colored object - how do you expect the 
illuminated spots to appear /in relation to/ each other?

If you specify two spotlights with brightness of "rgb 0.5" each, shining 
at the /same/ spot on an object - how do you expect the illuminated spot 
to appear /as compared to/ a single light source with brightnes of "rgb 
1.0" instead?

If you specify a light with brightness of "rgb 0.5" illuminating an 
object with a color of "red 1.0", how would you expect that object to 
appear /as compared to/ a similar scene having a light brightness of 
"rgb 1.0" and a color of "red 0.5"?


Of course you cannot name an /absolute/ value for how a color should 
appear in an image, unless you know exactly how bright "1.0" really is 
physically; but you can alway specify /relationships/ between multiple 
color or brightness levels you have specified in your scene. Gamma does 
not only affect the /absolute/ values, but also with the /relative/ ones.


> And from an arts perspective, the recent betas of 3.7 have produced results that
> looked like foot. But looked a lot better if I take them individually into a
> paint program after the fact - and reduce gamma by about ~50%.
> 
> Am I the only one who looks at things this way? Who is the target audience here,
> really? And what do they want and think? I am honestly curious.

I guess since this is an open source project and none of the developers 
get anything out of it except the fun of developing an interesting piece 
of software and/or get an improved version of their favorite ray tracing 
software, the target audience of POV-Ray is people having the same 
mindset about 3D rendering as the developers themselves.

I can't speak for the dev team, but I can speak for myself as a 
contributing developer: As a hobbyist I don't have access to 
professional physical light simulations; but having always been 
interested in natural science, my approach at trying to achieve effects 
is a very physics-oriented one; I'm not asking "how does /this/ software 
package happen to allow me to create that effect", but "how does /real 
life/ create it. And therefore that's how I want POV-Ray to operate, 
too, so I can more easily wrap my head around how to get the software to 
produce what I want.

I also think that it makes sense to follow this way even if other people 
approach it with that other mindset of "how does /POV-Ray/ allow me to 
create that effect" - because for those folks it wouldn't matter whether 
the rules by which POV-Ray operates are close to real-world physics, or 
some magic fantasy science.


Now as for your problems with POV-Ray 3.7, I suppose that they result 
not from this mindset per se, but rather from a change in the way how 
POV-Ray does things (especially gamma handling) that you just haven't 
got accustomed to - or from the known issues with input file gamma, 
which will be addressed with the next beta.


Post a reply to this message

From: Robert McGregor
Subject: Re: Gamma tutorial for the 3.7 documentation?
Date: 4 Nov 2009 21:30:00
Message: <web.4af237d9e70cefa24726e92b0@news.povray.org>
"Sven Geier" <.sven.at.sgeier.dot.net.nospamplease> wrote:
> All that said - my preferred way of looking at POV-Ray is from an arts
> perspective...And from an arts perspective, the recent betas of 3.7 have produced
results that
> looked like foot. But looked a lot better if I take them individually into a
> paint program after the fact - and reduce gamma by about ~50%.
>
> Am I the only one who looks at things this way? Who is the target audience here,
> really? And what do they want and think? I am honestly curious.

Wow, ouch, "foot" doesn't sound so good (although I'm not sure what that means
where you live), but I definitely look at POV from an artist's perspective too.
And even though I'm a programming geek I try to put aside most of the technical
trivia and just get shots to look the way I want, using whatever means I need to
achieve that look.

Anyway, as for me, this 3.7 gamma change has really hampered me this last
several weeks since I (finally) started using the beta, because I just didn't
understand what it was all about, my old POV mindset was so ingrained I thought
something had gone whacky (which from that point of view, it did).

Now I've realized that I need to learn more about how colors and intensities of
those colors are propagated to various hardware devices, and that gamma
correction is the tool to make sure we all see the same thing, regardless of
what system we're using (assuming default gamma settings are correct on various
computers, which it seems they're not, and that bugs me).

I'd honestly prefer to work in linear 1.0 floating point gamma space and have my
output be a non-dithered, non-clamped HDR/EXR so there's no information lost,
but to be able to see that image as a properly gamma corrected preview on my
render window that looks like what my non-linear human eye would expect it to.

Or maybe I should just take up oil painting again... it's so analog.


Post a reply to this message

From: Robert McGregor
Subject: Re: Gamma tutorial for the 3.7 documentation?
Date: 4 Nov 2009 21:40:01
Message: <web.4af23a1ae70cefa24726e92b0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:

> I guess since this is an open source project and none of the developers
> get anything out of it except the fun of developing an interesting piece
> of software and/or get an improved version of their favorite ray tracing
> software, the target audience of POV-Ray is people having the same
> mindset about 3D rendering as the developers themselves.

> I can't speak for the dev team, but I can speak for myself as a
> contributing developer: As a hobbyist I don't have access to
> professional physical light simulations; but having always been
> interested in natural science, my approach at trying to achieve effects
> is a very physics-oriented one; I'm not asking "how does /this/ software
> package happen to allow me to create that effect", but "how does /real
> life/ create it. And therefore that's how I want POV-Ray to operate,
> too, so I can more easily wrap my head around how to get the software to
> produce what I want.

Well said Chris! I couldn't agree more :D

> Now as for your problems with POV-Ray 3.7, I suppose that they result
> not from this mindset per se, but rather from a change in the way how
> POV-Ray does things (especially gamma handling) that you just haven't
> got accustomed to - or from the known issues with input file gamma,
> which will be addressed with the next beta.

That's certainly been a real pain in my "foot" lately (cool, I've learned a new
slang expression from Sven!)

I await the new beta with high hopes for it helping my gamma problems vanish
forever.


Post a reply to this message

From: Jim Holsenback
Subject: Re: Gamma tutorial for the 3.7 documentation?
Date: 7 Nov 2009 07:46:47
Message: <4af56c37@news.povray.org>
"Warp" <war### [at] tagpovrayorg> wrote in message 
news:4aa3a4e0@news.povray.org...
>  Preferably this tutorial would be somewhere in the documentation that 
> makes
> it prominent and visible, rather then buried under hundreds of similar
> subsections.

I see that there has been some activity on the Wiki with this issue ...

I have some ideas on places in the docs this should go:

In the reference there is already a section on setting display gamma:
http://wiki.povray.org/content/Documentation:Reference_Section_1.1#Setting_your_Display_Gamma

or

A new sub-section in the tutorial advanced features section with a link in:
http://wiki.povray.org/content/Documentation:Tutorial_Section_1#Introduction

perhaps expanding the list item 3 sentence in the intro to include a mention 
gamma, radiosity ... whatever.

any other ideas?

Jim


Post a reply to this message

From: clipka
Subject: Re: Gamma tutorial for the 3.7 documentation?
Date: 7 Nov 2009 09:44:07
Message: <4af587b7$1@news.povray.org>
Jim Holsenback schrieb:

> I see that there has been some activity on the Wiki with this issue ...
> 
> I have some ideas on places in the docs this should go:
> 
> In the reference there is already a section on setting display gamma:
>
http://wiki.povray.org/content/Documentation:Reference_Section_1.1#Setting_your_Display_Gamma
> 
> or
> 
> A new sub-section in the tutorial advanced features section with a link in:
> http://wiki.povray.org/content/Documentation:Tutorial_Section_1#Introduction
> 
> perhaps expanding the list item 3 sentence in the intro to include a mention 
> gamma, radiosity ... whatever.
> 
> any other ideas?

I think there are two major areas to cover on gamma:

(1) What is it all about?

(2) How to deal with gamma issues properly
(2a) How to set up POV-Ray
(2b) How to deal with issues creeping up later


We might want to place (2a) right in the "getting started" instructions, 
or at the very least reference it from there.

(1) and (2b) might go together somewhere in the tutorial section, and 
(2a) might be mentioned there again; however, given how much can be 
written about gamma, I think the whole topic is worth a "page" on its own.


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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