POV-Ray : Newsgroups : povray.general : Problem with gamma showcase in pov-ray tutorial Server Time
22 Dec 2024 18:11:35 EST (-0500)
  Problem with gamma showcase in pov-ray tutorial (Message 1 to 4 of 4)  
From: LiYanrui
Subject: Problem with gamma showcase in pov-ray tutorial
Date: 7 Sep 2017 08:35:01
Message: <web.59b13c08d9757f7ac530adb50@news.povray.org>
The section 2.3.4.1 in pov-ray tutorial
(http://www.povray.org/documentation/3.7.0/t2_3.html#t2_3_4) said, the following
options

+w640 +h480 +a0.3 +am1 +fN -d File_Gamma=sRGB
Output_File_Name=gamma_showcase.png

+w640 +h480 +a0.3 +am1 +fN -d File_Gamma=1.0
Output_File_Name=gamma_showcase_linear.png

would generate two images and they should look identical in
viewing software. I can not get such results. Why different File_Gammas can
generate same results?


Post a reply to this message

From: clipka
Subject: Re: Problem with gamma showcase in pov-ray tutorial
Date: 7 Sep 2017 10:03:52
Message: <59b151c8$1@news.povray.org>
Am 07.09.2017 um 14:34 schrieb LiYanrui:
> The section 2.3.4.1 in pov-ray tutorial
> (http://www.povray.org/documentation/3.7.0/t2_3.html#t2_3_4) said, the following
> options
> 
> +w640 +h480 +a0.3 +am1 +fN -d File_Gamma=sRGB
> Output_File_Name=gamma_showcase.png
> 
> +w640 +h480 +a0.3 +am1 +fN -d File_Gamma=1.0
> Output_File_Name=gamma_showcase_linear.png
> 
> would generate two images and they should look identical in
> viewing software. I can not get such results. Why different File_Gammas can
> generate same results?

Gamma is essentially all about how brightness values between total black
(0% brightness) and nominal white (100% brightness) are encoded in a
computer image. Such values are rarely encoded in a linear fashion, for
multiple reasons (one being backward compatibility with the physical
characteristics of old display hardware, the other being that such
non-linear encoding also turned out to be more efficient).

For example, a physical brightness of 50% (half the physical brightness
of nominal white) is typically /not/ encoded as 127 or 128 as one might
expect. Instead, it would traditionally have been encoded as something
around 186 in the IBM PC world, or something around 174 in the classic
Macintosh world.

Note how the encoding scheme used to be poorly standardized; therefore,
POV-Ray provides a parameter to specify the encoding scheme. That's the
`File_Gamma` parameter.

When `File_Gamma=X` is specified (with X being a numeric value), POV-Ray
encodes a physical brightness of 50% as (0.5^(1/X))*255. When
`File_Gamma=sRGB` is specified, a slightly more complicated formula is
used which is defined in the sRGB colour standard.

For most image file formats, this makes a huge difference in how the
image is displayed, as the image viewing software has no way to tell
what encoding scheme was used; it will just presume /some/ standard
scheme for all images. If the image was encoded with that scheme, the
image is displayed as intended. If the image was encoded with a
different scheme, the image will be displayed incorrectly.

The PNG file format is different, in that the encoding scheme used is
specified in the file header. Therefore, any reasonably good image
viewing software /should/ be perfectly capable of displaying the image
correctly, no matter what encoding scheme is used.


Unfortunately, there seems to be a growing pile of crappy image viewing
software out there that give **** about the encoding scheme information
stored in the PNG file header, and just blindly presume /some/ standard
scheme as with other image file formats.

The images created with the parameter settings

    +w640 +h480 +a0.3 +am1 +fN -d File_Gamma=sRGB
    Output_File_Name=gamma_showcase.png

and

    +w640 +h480 +a0.3 +am1 +fN -d File_Gamma=1.0
    Output_File_Name=gamma_showcase_linear.png

will be displayed identically /only if/ the image viewing software is
reasonably good, in that it honors the encoding scheme information in
the PNG image file header.

Most internet browsers do, and Ive's "IC" image viewer also does. Your
image viewing software apparently doesn't.


Post a reply to this message

From: LiYanrui
Subject: Re: Problem with gamma showcase in pov-ray tutorial
Date: 7 Sep 2017 21:15:01
Message: <web.59b1ee4ae60542e51fe8dc4a0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 07.09.2017 um 14:34 schrieb LiYanrui:
> > The section 2.3.4.1 in pov-ray tutorial
> > (http://www.povray.org/documentation/3.7.0/t2_3.html#t2_3_4) said, the following
> > options
> >
> > +w640 +h480 +a0.3 +am1 +fN -d File_Gamma=sRGB
> > Output_File_Name=gamma_showcase.png
> >
> > +w640 +h480 +a0.3 +am1 +fN -d File_Gamma=1.0
> > Output_File_Name=gamma_showcase_linear.png
> >
> > would generate two images and they should look identical in
> > viewing software. I can not get such results. Why different File_Gammas can
> > generate same results?
>
> Unfortunately, there seems to be a growing pile of crappy image viewing
> software out there that give **** about the encoding scheme information
> stored in the PNG file header, and just blindly presume /some/ standard
> scheme as with other image file formats.
>

Thanks you for your detailed explanations! I thought GIMP is not that kind of
software, but I am wrong. I viewd these two images in Firefox and they look
identical indeed.


Post a reply to this message

From: clipka
Subject: Re: Problem with gamma showcase in pov-ray tutorial
Date: 8 Sep 2017 09:46:25
Message: <59b29f31$1@news.povray.org>
Am 08.09.2017 um 03:12 schrieb LiYanrui:
> clipka <ano### [at] anonymousorg> wrote:
>> Am 07.09.2017 um 14:34 schrieb LiYanrui:
>>> The section 2.3.4.1 in pov-ray tutorial
>>> (http://www.povray.org/documentation/3.7.0/t2_3.html#t2_3_4) said, the following
>>> options
>>>
>>> +w640 +h480 +a0.3 +am1 +fN -d File_Gamma=sRGB
>>> Output_File_Name=gamma_showcase.png
>>>
>>> +w640 +h480 +a0.3 +am1 +fN -d File_Gamma=1.0
>>> Output_File_Name=gamma_showcase_linear.png
>>>
>>> would generate two images and they should look identical in
>>> viewing software. I can not get such results. Why different File_Gammas can
>>> generate same results?
>>
>> Unfortunately, there seems to be a growing pile of crappy image viewing
>> software out there that give **** about the encoding scheme information
>> stored in the PNG file header, and just blindly presume /some/ standard
>> scheme as with other image file formats.
>>
> 
> Thanks you for your detailed explanations! I thought GIMP is not that kind of
> software, but I am wrong. I viewd these two images in Firefox and they look
> identical indeed.

I suspect that most software these days that generates encoding scheme
information also writes full-fledged colour profile information, so that
viewing software isn't frequently tested with images that contain only
encoding scheme info.


Post a reply to this message

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