POV-Ray : Newsgroups : povray.beta-test : Same scene renders different in v3.7beta34 versus v3.62 : Re: Same scene renders different in v3.7beta34 versus v3.62 Server Time
6 Oct 2024 00:25:04 EDT (-0400)
  Re: Same scene renders different in v3.7beta34 versus v3.62  
From: clipka
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

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