POV-Ray : Newsgroups : povray.beta-test : Same scene renders different in v3.7beta34 versus v3.62 Server Time
6 Oct 2024 06:25:31 EDT (-0400)
  Same scene renders different in v3.7beta34 versus v3.62 (Message 71 to 80 of 104)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: clipka
Subject: Re: Same scene renders different in v3.7beta34 versus v3.62
Date: 2 Sep 2009 17:46:20
Message: <4a9ee7ac$1@news.povray.org>
*Wham!* *Wham!* *Wham!* (*bangs head on table*)

Are you /deliberately/ not following me?

So before I continue trying to answer your questions (I think I have 
answered them at least half a dozen times over), let's try to get this 
step by step:

(Chapter 1)

At the heart of POV-Ray, there is a rendering core designed to operate 
on /linear/ brightness values in three distinct spectral bands (R,G,B). 
Can we agree on this as a given fact?

If that is so (please interrupt me in case of any disagreement), then 
that core(!) rendering algorithm can be expressed as a function 
R(X,P)=Y, where X is the set of linear input brightness values, Y is the 
set of linear output brightness values, and P is the set of other 
core(!) parameters (such as scene geometry).

Let's also give a name to gamma-related transformations: Let's denote 
gamma pre-correction as g(Y)=Y', with Y in this case being a set of 
linear brightness values, and Y' being the corresponding gamma 
pre-corrected color values; let's likewise denote the inverse 
transformation as G(Y')=Y.

To finish up this chapter, can we agree that the rendering algorithm 
doesn't work properly for gamma pre-corrected values, i.e. that 
g(R(X,P)) != R(g(X),P)?


Post a reply to this message

From: Warp
Subject: Re: Same scene renders different in v3.7beta34 versus v3.62
Date: 3 Sep 2009 04:52:19
Message: <4a9f83c3@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> *Wham!* *Wham!* *Wham!* (*bangs head on table*)

  Yes, rather than answering my questions, just keep up your condescending
attitude.

-- 
                                                          - Warp


Post a reply to this message

From: Warp
Subject: Re: Same scene renders different in v3.7beta34 versus v3.62
Date: 3 Sep 2009 08:01:31
Message: <4a9fb01b@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
>   1) What exactly is the purpose of File_Gamma, given that it makes no
> difference (when creating a PNG file)?

>   2) Where is POV-Ray conjuring a gamma setting of 2.2 even though neither
> Display_Gamma nor File_Gamma were even close to that value?

>   3) Why do Display_Gamma and File_Gamma produce different results even
> if they are set to be the same (when creating a PNG file)?

>   4) Why does POV-Ray produce different results depending on the output
> image format? For example, rendering to a TGA file results in a different
> result than rendering to a PNG file when File_Gamma = 1.0 (the pixels are
> the same, but the gamma metadata makes the PNG different from the TGA).

>   5) How do I make POV-Ray 3.7 to produce a PNG which looks the same as
> what it displayed on screen and as it produces when outputting to a TGA
> file?

  Why is it so hard to answer these questions? I think the questions are
rather simple and straightforward.

  I'm especially interested in question number 4. If the PNG file that
POV-Ray 3.7 currently writes is always correct, as seems to be the claim,
then why is POV-Ray 3.7 writing an "incorrect" result to eg. a TGA file?
Does that mean that outputting to a TGA file is currently broken?

  If the answer to that is "yes", then that brings up question #1 above.

  That answer also implies the same answer for question #3: That the image
preview is currently broken. If this is so, then what purpose does
Display_Gamma serve?

  It also implies something else: That POV-Ray 3.7 should always force a
gamma correction of 2.2 regardless of what Display_Gamma and File_Gamma are.
Wouldn't this kind of defeat the entire purpose of gamma correction in the
first place (in other words, that the image could be created in hardware
which has a gamma correction different from 2.2, and thus you should have
a way of specifying what that gamma is)?

  However, if the output to TGA is *not* broken, that means that the output
to PNG *is* broken because POV-Ray 3.7 is currently writing different things
to these two image formats.

  You can't have it both ways (ie. the output to PNG and TGA being both
correct at the same time). Either one or the other is broken. If your
opinion is that the output to TGA is broken, that raises a whole lot of
issues, as I wrote above.

  If the output to PNG is currently broken, it should be fixed.

-- 
                                                          - Warp


Post a reply to this message

From: Warp
Subject: Re: Same scene renders different in v3.7beta34 versus v3.62
Date: 3 Sep 2009 09:36:49
Message: <4a9fc670@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
>   I'm especially interested in question number 4. If the PNG file that
> POV-Ray 3.7 currently writes is always correct, as seems to be the claim,
> then why is POV-Ray 3.7 writing an "incorrect" result to eg. a TGA file?
> Does that mean that outputting to a TGA file is currently broken?

  I have demonstrated this phenomenon here:

http://warp.povusers.org/povray_gamma_issue/index.html

  The PNG basically ignores File_Gamma (as a net effect), while a TGA
doesn't, and thus the latter matches the preview window.

-- 
                                                          - Warp


Post a reply to this message

From: clipka
Subject: Re: Same scene renders different in v3.7beta34 versus v3.62
Date: 3 Sep 2009 09:46:47
Message: <4a9fc8c7$1@news.povray.org>
Warp schrieb:

>>   1) What exactly is the purpose of File_Gamma, given that it makes no
>> difference (when creating a PNG file)?

Specifying the encoding gamma for file formats that leave this up to the 
creator of the file; pixel values will be transformed by 
f(x)=x^encoding_gamma before writing to the file, where encoding_gamma = 
1/File_Gamma. The decoding software is expected to invert this 
transformation as appropriate and then apply display gamma correction 
itself. As AFAIK support for the gAMA chunk is not mandatory, some 
decoding software may however interpret this encoding gamma as a display 
gamma pre-correction

For file formats with no explicit gamma handling, this corresponds to 
the gamma pre-correction, which should be f(x)=x^(1/target_gamma), where 
target_gamma is the total gamma of the target system (often equal to its 
display hardware gamma), so File_Gamma should be set to target_gamma in 
this case.


2) Where is POV-Ray conjuring a gamma setting of 2.2 even though neither
>> Display_Gamma nor File_Gamma were even close to that value?

It is not POV-Ray that is conjuring up this gamma, but the viewing 
software: It is the presumed display hardware gamma, which it will 
compensate for.


>>   3) Why do Display_Gamma and File_Gamma produce different results even
>> if they are set to be the same (when creating a PNG file)?

Because they are meant for slightly different purposes.


>>   4) Why does POV-Ray produce different results depending on the output
>> image format? For example, rendering to a TGA file results in a different
>> result than rendering to a PNG file when File_Gamma = 1.0 (the pixels are
>> the same, but the gamma metadata makes the PNG different from the TGA).

Because the TGA file format is not gamma-aware, and therefore must be 
created with a gamma pre-correction to match whatever target system it 
is to be displayed on. Getting this wrong will result in different output.


>>   5) How do I make POV-Ray 3.7 to produce a PNG which looks the same as
>> what it displayed on screen and as it produces when outputting to a TGA
>> file?

Set Display_Gamma to whatever your display hardware gamma is (typically 
something around 2.2), and set File_Gamma to the same value. (Not so 
difficult, is it?)


>   Why is it so hard to answer these questions? I think the questions are
> rather simple and straightforward.

They are simple, and they are simple to answer, but you keep asking them 
again and again, with virtually no variations, with no sign that any 
attempts to answer them are actually being read, which is perfectly 
frustrating.


>   I'm especially interested in question number 4. If the PNG file that
> POV-Ray 3.7 currently writes is always correct, as seems to be the claim,
> then why is POV-Ray 3.7 writing an "incorrect" result to eg. a TGA file?
> Does that mean that outputting to a TGA file is currently broken?

The output should look identical. Provided that you have set both 
Display_Gamma and File_Gamma properly - which not only means that they 
should be set to the same values (which is rather a coincicence, because 
the target system happens to be your own), but more importantly that 
they match the actual display hardware gamma.

Setting any of them to 1.0 will defy their purposes.


>   It also implies something else: That POV-Ray 3.7 should always force a
> gamma correction of 2.2 regardless of what Display_Gamma and File_Gamma are.

This is an incorrect observation, based on the hard fact that your 
viewing software implies a display hardware gamma of 2.2. If you had a 
mac, you would probably get the impression that there was some part in 
the software forcing a gamma correction of 1.8 (or whatever the Mac 
typically uses - don't know by heart).


>   However, if the output to TGA is *not* broken, that means that the output
> to PNG *is* broken because POV-Ray 3.7 is currently writing different things
> to these two image formats.
> 
>   You can't have it both ways (ie. the output to PNG and TGA being both
> correct at the same time). Either one or the other is broken. If your
> opinion is that the output to TGA is broken, that raises a whole lot of
> issues, as I wrote above.

Oh yes, you can: The simple explanation being that your Display_Gamma is 
"broken" when you set it to 1.0 instead of whatever value matches your 
system, and that File_Gamma is likewise "broken" when you set it to 1.0 
instead of whatever gamma pre-correction the target system silently 
expects for file formats not carrying any gamma information.


Post a reply to this message

From: clipka
Subject: Re: Same scene renders different in v3.7beta34 versus v3.62
Date: 3 Sep 2009 09:53:09
Message: <4a9fca45$1@news.povray.org>
Warp schrieb:
>   I have demonstrated this phenomenon here:
> 
> http://warp.povusers.org/povray_gamma_issue/index.html

Which perfectly supports my claim that you should set Display_Gamma and 
File_Gamma according to their technical purpose, not according to your 
artistic taste. Note that with File_Gamma=2.2, all is well with the 
world. On a different system (e.g. Mac), the value where all three look 
the same is likely to be different (and may even require different 
settings for File_Gamma and Display_Gamma, in case the viewing software 
happens to expect TIF files to be pre-corrected for a PC-typical display 
gamma).


Post a reply to this message

From: Fredrik Eriksson
Subject: Re: Same scene renders different in v3.7beta34 versus v3.62
Date: 3 Sep 2009 10:12:36
Message: <op.uzoprbfs7bxctx@bigfrog.bredbandsbolaget.se>
On Thu, 03 Sep 2009 15:36:49 +0200, Warp <war### [at] tagpovrayorg> wrote:
>
>   I have demonstrated this phenomenon here:
>
> http://warp.povusers.org/povray_gamma_issue/index.html
>
>   The PNG basically ignores File_Gamma (as a net effect), while a TGA
> doesn't, and thus the latter matches the preview window.

When you specify a Display_Gamma that does not match the actual gamma  
response of your monitor, you are effectively lying to POV-Ray.  
Consequently, POV-Ray shows a preview with incorrect brightness.

When you specify a File_Gamma, you are telling POV-Ray to apply that gamma  
curve to the image data it produces on file. When you output to a  
gamma-aware format like PNG the gamma value is recorded in the file so  
other programs will know what gamma curve to apply in order to make the  
image look right on a given display. Many modern image viewers perform  
this gamma correction. When you output to a gamma-unaware format like TGA  
there is no way to record the gamma value in the file. It is therefore up  
to the user to remember the gamma value and apply gamma correction as  
necessary. If you do not want to have to perform this gamma correction  
yourself, you should use a File_Gamma that matches the gamma of the  
intended output display.

What you seem to want is to use colour values that look a certain way in a  
gamma-2.2 environment and have them look the same in the output *and* have  
the same numerical value in the output as they did on input. To the extent  
that I understand these things, the correct way is to alter the colour  
values on input, because POV-Ray expects linear colours on input. This is  
handled automatically for input images in PNG-format if they have a  
correctly set gAMA chunk, but other inputs must be corrected "by hand".



-- 
FE


Post a reply to this message

From: Warp
Subject: Re: Same scene renders different in v3.7beta34 versus v3.62
Date: 3 Sep 2009 10:32:40
Message: <4a9fd388@news.povray.org>
Fredrik Eriksson <fe79}--at--{yahoo}--dot--{com> wrote:
> When you specify a Display_Gamma that does not match the actual gamma  
> response of your monitor, you are effectively lying to POV-Ray.  
> Consequently, POV-Ray shows a preview with incorrect brightness.

  I do understand that. However, my point is that there are situations
where you are not rendering for your display, but for something else
(for example to match HTML colors, or the colors of an existing image).

  As it is now, there's no "official" way of making 3.7 to create a PNG
file which is the same as what 3.6 creates. Even "#version 3.6" won't do
that (because 3.7 will still write the gamma info to the PNG file, making
it look different). The only way to achieve that is to "abuse" side-effects
of other file formats not having support for gamma information.

> When you specify a File_Gamma, you are telling POV-Ray to apply that gamma  
> curve to the image data it produces on file. When you output to a  
> gamma-aware format like PNG the gamma value is recorded in the file so  
> other programs will know what gamma curve to apply in order to make the  
> image look right on a given display. Many modern image viewers perform  
> this gamma correction. When you output to a gamma-unaware format like TGA  
> there is no way to record the gamma value in the file. It is therefore up  
> to the user to remember the gamma value and apply gamma correction as  
> necessary. If you do not want to have to perform this gamma correction  
> yourself, you should use a File_Gamma that matches the gamma of the  
> intended output display.

  I do understand the motivation of making the image always look the
same regardless of what were the gamma settings of the system where the
image was rendered and the gamma settings of the system where the image
is displayed.

  However, there are situations where you precisely *don't want* that.
You want raw pixel values, and nothing else, as I exemplified above.

  Also it could be advantageous if POV-Ray 3.7 could be used to render
POV-Ray 3.6 scenes to get the same result. Currently "#version 3.6"
almost does that, but not quite (not when outputting to PNG).

> What you seem to want is to use colour values that look a certain way in a  
> gamma-2.2 environment and have them look the same in the output *and* have  
> the same numerical value in the output as they did on input. To the extent  
> that I understand these things, the correct way is to alter the colour  
> values on input, because POV-Ray expects linear colours on input.

  It might be the "most correct" way, but it might not always be practical.

  The basic example is, as said, when trying to render a scene designed
for POV-Ray 3.6: It's a bit unreasonable to expect you to go and change
all the colors used in the scene just to match the new approach in 3.7.

  Also, as demonstrated earlier, input images are currently not
gamma-corrected properly, which makes them look too bright. While this
problem will surely be fixed at some point, there are also other sources
of color than just image files. For example one could use a graphical
color picker to choose colors, and if they are written as-is into a
POV-Ray 3.7 scene, they will not look the same as in the color picker
application. It seems that the ideology in POV-Ray 3.7 color handling
is that the user must always pre-correct all color values by hand, as
POV-Ray itself offers little help in this. Is this practical?

> This is  
> handled automatically for input images in PNG-format if they have a  
> correctly set gAMA chunk, but other inputs must be corrected "by hand".

  It's absolutely unreasonable for POV-Ray to not to offer any way of
automatically gamma-correcting input images which do not have gamma
information in them.

-- 
                                                          - Warp


Post a reply to this message

From: Warp
Subject: Re: Same scene renders different in v3.7beta34 versus v3.62
Date: 3 Sep 2009 10:42:46
Message: <4a9fd5e6@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
>   However, there are situations where you precisely *don't want* that.
> You want raw pixel values, and nothing else, as I exemplified above.

  I just figured out the *perfect* example of a situation where you want
raw, linear pixel values which are *not* gamma-corrected: When you are
rendering an image which will be used as input to create a heightfield.

  There 0.5 should mean exactly half height, not a height of 0.73.

  clipca asked some time ago *why* one would ever want linear, uncorrected
pixel values. There you have your perfect example.

-- 
                                                          - Warp


Post a reply to this message

From: Mike Raiford
Subject: Re: Same scene renders different in v3.7beta34 versus v3.62
Date: 3 Sep 2009 10:46:46
Message: <4a9fd6d6$1@news.povray.org>
Warp wrote:

>   I just figured out the *perfect* example of a situation where you want
> raw, linear pixel values which are *not* gamma-corrected: When you are
> rendering an image which will be used as input to create a heightfield.
> 
>   There 0.5 should mean exactly half height, not a height of 0.73.
> 
>   clipca asked some time ago *why* one would ever want linear, uncorrected
> pixel values. There you have your perfect example.

I think 3.7 needs a simple flag: Gamma_Correction on will apply gamma 
correction to the file, off will not apply gamma correction to the file 
(and will not write a gAMA chunk to PNG files)



-- 
~Mike


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

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