POV-Ray : Newsgroups : povray.binaries.tutorials : Check(er) Your Gamma Server Time: 12 Dec 2018 09:21:58 GMT
  Check(er) Your Gamma (Message 1 to 10 of 24)  
Goto Latest 10 Messages Next 10 Messages >>>
From: clipka
Subject: Check(er) Your Gamma
Date: 4 Nov 2009 04:25:53
Message: <4af10251$1@news.povray.org>
You know your gamma settings are wrong if...

... you see a chrome sphere on a /checkered/ plane (even if you squint 
your eyes or look from a distance) in this image/scene.

Ideally, the plane should appear in a featureless uniform grey (except 
for some moiree effects near the horizon and maybe in the reflection). 
If instead it appears to show squares of alternating shades of grey, 
something's bogus:

(A) If you see checkering in the attached image file, then your image 
viewing software / operating system / graphics drivers / display 
hardware is poorly calibrated, and you should fix it before proceeding.

(B) If (after fixing (A)) you see checkering in the preview window 
and/or the output file when rendering the scene file below, then your 
Display_Gamma (POV-Ray 3.6 and 3.7) and/or File_Gamma setting (POV-Ray 
3.7 only), respectively, is wrong.


-----------------------------------------------------
// +w640 +h480 +a0.3

#include "colors.inc"

global_settings { #if (version < 3.7) assumed_gamma 1.0 #end }

#local CameraPos   = <0.0,0.0,-4.0>;
#local CameraDepth = 1.0;
#local CameraTilt  = 5;

camera {
   location  <0,0,0>
   direction z*CameraDepth
   right     x*image_width/image_height
   up        y
   translate CameraPos
   rotate    x*CameraTilt
}

sky_sphere {
   pigment {
     gradient y
     color_map {
       [0.0 rgb <0.6,0.7,1.0>]
       [0.7 rgb <0.0,0.1,0.8>]
     }
   }
}

light_source {
   <-30,30,-30>
   color rgb 1
   parallel
}

#declare Ratio = image_height*CameraDepth;
#declare FnScanlines = function { abs(mod(abs(Ratio*y/z+0.5),2.0)-1.0) }

plane {
   y, -1
   pigment {
     checker
     pigment { color rgb 0.5 }
     pigment {
       function { FnScanlines(x,y,z) }
       color_map {
         [0.0 color rgb 0.0 ]
         [0.5 color rgb 0.0 ]
         [0.5 color rgb 1.0 ]
         [1.0 color rgb 1.0 ]
       }
       translate CameraPos
       rotate x*CameraTilt
       rotate y*-30
       scale 1/3
     }
     scale 3
     rotate y*30
   }
}

sphere {
   0, 1
   pigment { color rgb 1 }
   finish { ambient 0 diffuse 0 reflection { 1 } }
}
-----------------------------------------------------


Post a reply to this message

From: clipka
Subject: Re: Check(er) Your Gamma
Date: 4 Nov 2009 04:28:17
Message: <4af102e1@news.povray.org>
Forgot to attach the image... here it is.


Post a reply to this message


Attachments:
Download 'gammatest.png' (58 KB)

Preview of image 'gammatest.png'
gammatest.png


 

From: SharkD
Subject: Re: Check(er) Your Gamma
Date: 4 Nov 2009 04:37:24
Message: <4af10504$1@news.povray.org>
On 11/3/2009 11:27 PM, clipka wrote:
> Forgot to attach the image... here it is.

I see alternating gray squares. Should I kill myself now?

Mike


Post a reply to this message

From: clipka
Subject: Re: Check(er) Your Gamma
Date: 4 Nov 2009 14:01:01
Message: <4af1891d$1@news.povray.org>
SharkD schrieb:
> On 11/3/2009 11:27 PM, clipka wrote:
>> Forgot to attach the image... here it is.
> 
> I see alternating gray squares. Should I kill myself now?

I wouldn't go as far as that ;-)

It's just that if you share your rendered images and/or scenes (or 
include files that do anything with color or brightness), other people 
will not get what you see. (Unless their system, too, happens to be 
mis-calibrated in the same manner :-))


Post a reply to this message

From: SharkD
Subject: Re: Check(er) Your Gamma
Date: 5 Nov 2009 04:14:54
Message: <4af2513e$1@news.povray.org>
On 11/4/2009 9:00 AM, clipka wrote:
> SharkD schrieb:
>> On 11/3/2009 11:27 PM, clipka wrote:
>>> Forgot to attach the image... here it is.
>>
>> I see alternating gray squares. Should I kill myself now?
>
> I wouldn't go as far as that ;-)
>
> It's just that if you share your rendered images and/or scenes (or
> include files that do anything with color or brightness), other people
> will not get what you see. (Unless their system, too, happens to be
> mis-calibrated in the same manner :-))

The instructions for adjusting your display settings are already in the 
docs, aren't they?

Mike


Post a reply to this message

From: clipka
Subject: Re: Check(er) Your Gamma
Date: 5 Nov 2009 04:58:17
Message: <4af25b69$1@news.povray.org>
SharkD schrieb:

> The instructions for adjusting your display settings are already in the 
> docs, aren't they?

If you're referring to setting up POV-Ray, then yes: The POV-Ray 3.6 
instructions how to identify the proper Display_Gamma setting for your 
system are still valid for 3.7.

If you're referring to setting up your image viewer / operating system / 
  graphics driver / display hardware, you will have to check out the 
respective manuals and/or them interwebs.

Usually your graphics card will have come with /some/ tool to check and 
adjust your display gamma to whatever the operating system typically 
expects, and most image viewers will rely on the operating system and 
drivers for converting from the OS' standard gamma to the display 
hardware gamma.


On a properly calibrated Windows PC, following the instructions to set 
up your Display_Gamma should usually give you a setting of 2.2.


Post a reply to this message

From: Edouard
Subject: Re: Check(er) Your Gamma
Date: 5 Nov 2009 11:30:01
Message: <web.4af2b6982d58a2835b81d0ec0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> You know your gamma settings are wrong if...
>
> ... you see a chrome sphere on a /checkered/ plane (even if you squint
> your eyes or look from a distance) in this image/scene.
>
> Ideally, the plane should appear in a featureless uniform grey (except
> for some moiree effects near the horizon and maybe in the reflection).
> If instead it appears to show squares of alternating shades of grey,
> something's bogus:
>
> (A) If you see checkering in the attached image file, then your image
> viewing software / operating system / graphics drivers / display
> hardware is poorly calibrated, and you should fix it before proceeding.
>
> (B) If (after fixing (A)) you see checkering in the preview window
> and/or the output file when rendering the scene file below, then your
> Display_Gamma (POV-Ray 3.6 and 3.7) and/or File_Gamma setting (POV-Ray
> 3.7 only), respectively, is wrong.

Well that produces a broken file for me if I choose to output a PNG file (i.e.
the gray value isn't half the white value). HDR output works though (as I assume
it's in linear space).

Cheers,
Edouard.


Post a reply to this message

From: clipka
Subject: Re: Check(er) Your Gamma
Date: 5 Nov 2009 15:46:45
Message: <4af2f365$1@news.povray.org>
Edouard schrieb:

>> (B) If (after fixing (A)) you see checkering in the preview window
>> and/or the output file when rendering the scene file below, then your
>> Display_Gamma (POV-Ray 3.6 and 3.7) and/or File_Gamma setting (POV-Ray
>> 3.7 only), respectively, is wrong.
> 
> Well that produces a broken file for me if I choose to output a PNG file (i.e.
> the gray value isn't half the white value). HDR output works though (as I assume
> it's in linear space).

Careful!

How did you /check/ that the gray value isn't "half the white value"?

If you squint your eyes to "blur" the black-and-white-striped squares, 
and it then /appears/ to have the same brightness as the gray value, 
then that gray value /is/ half as bright as the white.

Note that Photoshop lies to you about brightness (and so do your eyes). 
Photoshop also uses physically wrong math when blurring images (at least 
the old version I own does).

The /physical/ blurring by squinting your eyes, however, does indeed 
comprise a physically correct "computation" of (black+white)/2 (taking a 
few steps back may do the same job, and some people may just need to 
take off their glasses), which obviously gives you a grey of /truly/ 
half the white value (*), which you can then visually compare to the 
grey of /allegedly/ half the white value.

(* provided you have set your display's black point properly)


Post a reply to this message

From: Edouard
Subject: Re: Check(er) Your Gamma
Date: 5 Nov 2009 21:15:01
Message: <web.4af33fb22d58a2835b81d0ec0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Edouard schrieb:
>
> >> (B) If (after fixing (A)) you see checkering in the preview window
> >> and/or the output file when rendering the scene file below, then your
> >> Display_Gamma (POV-Ray 3.6 and 3.7) and/or File_Gamma setting (POV-Ray
> >> 3.7 only), respectively, is wrong.
> >
> > Well that produces a broken file for me if I choose to output a PNG file (i.e.
> > the gray value isn't half the white value). HDR output works though (as I assume
> > it's in linear space).
>
> Careful!
>
> How did you /check/ that the gray value isn't "half the white value"?
>
> If you squint your eyes to "blur" the black-and-white-striped squares,
> and it then /appears/ to have the same brightness as the gray value,
> then that gray value /is/ half as bright as the white.

I can see it's displayed correctly. That's great. But you've taken the decision
that the file should be output with that display gamma baked in, and that's not
something that's desirable under all circumstances (like, for example, any
manipulation of the image afterwards).

> Note that Photoshop lies to you about brightness (and so do your eyes).
> Photoshop also uses physically wrong math when blurring images (at least
> the old version I own does).

No - Photoshop is doing a sensible thing, and that's to work in linear space
(exactly the same way that POV does). Photoshop is a production tool, and having
gamma applied half way through your workflow will just screw everything up.

If you assign a linear profile to the image (which you started to be able to do
in Photoshop 6), then Photoshop not only displayed the image correctly, but all
operations (like blurring it) also work exactly as you would want. I've attached
an image with a linear profile and one half blurred as an example.

Scaling the image also fails if there isn't a linear profile attached, and lots
of users here like to scale their final images down and don't really consider
that post-processing. Baked-in gamma makes that work incorrectly.

> The /physical/ blurring by squinting your eyes, however, does indeed
> comprise a physically correct "computation" of (black+white)/2 (taking a
> few steps back may do the same job, and some people may just need to
> take off their glasses), which obviously gives you a grey of /truly/
> half the white value (*), which you can then visually compare to the
> grey of /allegedly/ half the white value.

I'm arguing that for a digital artist who is using POV as part of their
workflow, having tools like Photoshop's blur give identical "output" to what you
see when you do the "squint" method, is a good thing.

I'm sure lots of people will be happy to bake the gamma into their file if they
are producing "final" images with POV, and not intending to post-process them in
any way (as long as they know scaling the image is then a no-no). But there are
plenty of others who use POV in a workflow that includes scaling and other post
processing, and we would be better suited with having linear ICC profiles
attached to the images. There is no "right" way, it all depends on how the user
is intending to use the image.

(Well, once ICC support is universal, then I would argue that a linear image
with the correct ICC profile is "right". We're not that far from that are we? On
my Mac, the OS, the browser, and image preview app, and the pro software like
Photoshop all get a linear ICC profiled file right every time...)

Cheers,
Edouard.


Post a reply to this message


Attachments:
Download 'gamma-test-linear.png' (136 KB)

Preview of image 'gamma-test-linear.png'
gamma-test-linear.png


 

From: clipka
Subject: Re: Check(er) Your Gamma
Date: 5 Nov 2009 23:43:48
Message: <4af36334@news.povray.org>
Edouard schrieb:

> I can see it's displayed correctly. That's great. But you've taken the decision
> that the file should be output with that display gamma baked in, and that's not
> something that's desirable under all circumstances (like, for example, any
> manipulation of the image afterwards).

No, this is absolutely the proper way to do it with PNG image files, as 
per the PNG file specification.

>> Note that Photoshop lies to you about brightness (and so do your eyes).
>> Photoshop also uses physically wrong math when blurring images (at least
>> the old version I own does).
> 
> No - Photoshop is doing a sensible thing, and that's to work in linear space
> (exactly the same way that POV does). Photoshop is a production tool, and having
> gamma applied half way through your workflow will just screw everything up.

No, that's exactly the problem: Photoshop is /not/ working in linear 
space - it happens to work in /whatever/ space the image happens to be 
encoded in.

As linear encoding gives a great deal of precision loss with 
low-brightness values (at the benefit of some precision gain with 
high-brightness values, where it's not really needed), thereby leading 
to color banding in dark areas, linear encoding is /not/ suited for 
8-bit color depth images.


>> The /physical/ blurring by squinting your eyes, however, does indeed
>> comprise a physically correct "computation" of (black+white)/2 (taking a
>> few steps back may do the same job, and some people may just need to
>> take off their glasses), which obviously gives you a grey of /truly/
>> half the white value (*), which you can then visually compare to the
>> grey of /allegedly/ half the white value.
> 
> I'm arguing that for a digital artist who is using POV as part of their
> workflow, having tools like Photoshop's blur give identical "output" to what you
> see when you do the "squint" method, is a good thing.

Sure it is; however, color banding is a bad thing, and therefore 8-bit 
linear encoded PNG is /not/ an option either.


> I'm sure lots of people will be happy to bake the gamma into their file if they
> are producing "final" images with POV, and not intending to post-process them in
> any way (as long as they know scaling the image is then a no-no). But there are
> plenty of others who use POV in a workflow that includes scaling and other post
> processing, and we would be better suited with having linear ICC profiles
> attached to the images. There is no "right" way, it all depends on how the user
> is intending to use the image.

Feel free to use "File_Gamma=1.0" on the output file, which does exactly 
what you demand - except that it doesn't attach an ICC profile, but 
"only" a gAMA chunk, because an ICC profile would inevitably have to be 
a lie (POV-Ray is presently gamma- but not color space-aware). It's a 
shame that Photoshop 6.0 fails to support the gAMA chunk, but that's not 
POV-Ray's fault. And you can actually work around the problem by 
manually assigning your favorite linear ICC profile to the image /after/ 
you have loaded it into Photoshop.

And don't complain about any color banding you may observe: You're 
asking for it.


(BTW, to scale a gamma-encoded image without messing up the colors, I 
can highly recommend IC. It does properly convert the image to linear 
color space before resampling.)


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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