POV-Ray : Newsgroups : povray.off-topic : Ray tracing and gamma correction Server Time
7 Sep 2024 01:20:19 EDT (-0400)
  Ray tracing and gamma correction (Message 1 to 4 of 4)  
From: Severi Salminen
Subject: Ray tracing and gamma correction
Date: 24 Sep 2008 12:53:22
Message: <48da7082$1@news.povray.org>
A question about ray tracing and gamma correction.

The images my path tracer now produces don't have any gamma correction.
For example, a spot light shines on a surface and the color of that
surface is (say) RGB=255,255,255 (pure white in this case). If the
spotlight is moved twice as far, the color is now RGB=64,64,64. So I
have a linear tone mapping.

The question is: would a gamma corrected output be any more correct than
this linear? If I corrected with gamma 2.2, the first case would give
RGB=255,255,255 again and the second case would give RGB=136,136,136.

Why would I prefer one over the other? I have seen ray tracers doing
both. I'm not sure which way would give "better" results and what would
the "better" even mean in this case...

Severi S


Post a reply to this message

From: scott
Subject: Re: Ray tracing and gamma correction
Date: 25 Sep 2008 03:20:15
Message: <48db3baf$1@news.povray.org>
> The question is: would a gamma corrected output be any more correct than
> this linear? If I corrected with gamma 2.2, the first case would give
> RGB=255,255,255 again and the second case would give RGB=136,136,136.
>
> Why would I prefer one over the other?

Because if you give your monitor (or pretty much any monitor) 64,64,64, it's 
not 4x dimmer than 255,255,255.  You need to give it 136,136,136 (or 
whatever) to get that.

The original reason for this is that inside a CRT, the "brightness" you saw 
was not linearly related to the applied voltage, but a gamma curve. 
Everything was designed for CRTs, so LCDs had to follow in order not to look 
stupid.

Also, it's not a bad design anyway, because it gives you more detail in the 
darker colours where your eye is more sensitive (ie instead of having only 
64 discrete brightnesses between 0 and 1/4 brightness, you now have 136).


Post a reply to this message

From: Severi Salminen
Subject: Re: Ray tracing and gamma correction
Date: 25 Sep 2008 12:15:27
Message: <48dbb91f$1@news.povray.org>
scott wrote:
> Because if you give your monitor (or pretty much any monitor) 64,64,64,
> it's not 4x dimmer than 255,255,255.  You need to give it 136,136,136
> (or whatever) to get that.


That is true!

I have a visually calibrated LCD screen using this page and test chart:

http://www.normankoren.com/makingfineprints1A.html#gammachart

My monitor gamma seems to be in order (around 2.2). And it really means
that in order to get half luminance of pure white, I have to use RGB =
186,186,186 - as opposed to 123,123,123.

So yes, I have to start using gamma correction from now on. Thanks.

Now I have to figure out a better way to define object color. As
specifying it RGB= 180,100,100 gives a totally different output. Idea, I
could just do a inverse gamma correction to those values first....and
yes, it seems to work just right.

Severi


Post a reply to this message

From: scott
Subject: Re: Ray tracing and gamma correction
Date: 26 Sep 2008 04:12:18
Message: <48dc9962$1@news.povray.org>
> My monitor gamma seems to be in order (around 2.2).

The problem with most monitors is that they are not actually programmed 
exactly with a gamma curve, it's usually something approximating a gamma 
curve, but typically goes off at the black and white ends.  Of course you 
also need to check your monitor settings, things like "brightness" and 
"contrast" can really screw up the "gamma" curve.

> Now I have to figure out a better way to define object color. As
> specifying it RGB= 180,100,100 gives a totally different output. Idea, I
> could just do a inverse gamma correction to those values first....and
> yes, it seems to work just right.

Yes, this is an area where POV also (used to?) do things wrong.  When the 
user inputs a colour, or texture, that data is already in gamma-corrected 
colour space (because they see the colour on their monitor).  You need to 
inverse-gamma-correct that colour/texture FIRST, before you do any 
raytracing, because your raytracer must work in linear colour space.  At the 
very very end you can gamma correct the raytraced image to show on a 
monitor.

IIRC POV doesn't/didn't inverse-gamma-correct textures, which is why the 
colours often came out weird unless you used gamma 0.  Maybe this has been 
fixed now I haven't checked.


Post a reply to this message

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