POV-Ray : Newsgroups : povray.general : strange problem with srgb color in light_source Server Time
29 Mar 2024 04:13:16 EDT (-0400)
  strange problem with srgb color in light_source (Message 36 to 45 of 45)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Cousin Ricky
Subject: Re: strange problem with srgb color in light_source
Date: 7 Apr 2021 12:33:54
Message: <606ddef2@news.povray.org>
On 2021-04-07 8:20 AM (-4), Kenneth wrote:
> Cousin Ricky <ric### [at] yahoocom> wrote:
>>
>> If you are starting with a fractional literal such as <.7,.8,.9>, then
>> I'm with Ive: I don't know why you'd want to mess with non-linear
>> encoding at all.  Just start with a literal triplet that looks correct
>> with the rgb keyword.
> 
> You're correct, of course. In my case, I was pulling in RGB colors from an *old*
> scene-- circa v3.5 or 3.6-- that I used to mistakenly run with an assumed_gamma
> of 2.2(!), just to get the rgb colors there to 'look' the way I thought they
> should. Some were of the form <.7,.8,.9>, some as like <104,230,75>/255. That
> was way before the 'srgb' keyword was introduced, and before I started correctly
> using assumed_gamma 1.0. So I'm updating the old colors to srgb now, to try and
> reproduce some semblance of what I saw in the old days.

That makes sense.  I haven't had to do that, because I started using
assumed_gamma 1 from literally my second day using POV-Ray.  I never had
to make any transition.  But if you're converting old scenes, by all
means use srgb <.7,.8,.9>.

I had been wrestling with gamma long before I downloaded POV-Ray, so I
was onto assumed_gamma in version 3.5, before most POVers realized that
this was an issue.


Post a reply to this message

From: Bald Eagle
Subject: Re: strange problem with srgb color in light_source
Date: 7 Apr 2021 16:40:01
Message: <web.606e1889a9b7c9591f9dae3025979125@news.povray.org>
Cousin Ricky <ric### [at] yahoocom> wrote:

> Wrong, wrong, wrong!


Post a reply to this message


Attachments:
Download '54oodi.jpg' (82 KB)

Preview of image '54oodi.jpg'
54oodi.jpg


 

From: Subclick
Subject: Re: strange problem with srgb color in light_source
Date: 7 Apr 2021 17:20:01
Message: <87a6q9zta7.fsf@sp.am>
"Kenneth" <kdw### [at] gmailcom> writes:

> I run my old version of Photoshop in it's gamma 2.2 'working gamma space', as
> most people do (unless newer versions run in 'srgb'-- but that's a minor
> quibble.)
>
> When I want to specify "50% gray" there, I use r-g-b values of <128,128,128> in
> the 0-255 range. And the HSB indicators there give B or 'brightness' as 50.  I
> have always understood the  visual result there (under 2.2 gamma) to be the
> *perceptual* version of 50% gray-- what we would 'expect' to see as pleasing
> half black/half white.
>
> But Photoshop allows me to change the working gamma space to 1.0-- in which case
> the 50% gray now looks too bright 'perceptually.' However, the <128,128,128>
> values there have NOT changed, nor has the B of 50. In effect, all I have done
> is to change the working gamma space that the 50%-gray appears in-- the values
> themselves are 'what they are.' At least in Photoshop.

The numeric values of the color components are “what they are”; the
light intensities on the screen, and hence the actual color you see,
have changed, because you have changed the relationship between them and
the numeric values of the color components.

> Now, in  POV-ray, working in it's assumed_gamma 1.0 universe, I bring in
> <128,128,128>/255 and use it as simple RGB, at 'ambient 1.0'-- as a raw 'linear'
> color, in other words. (That's what I currently undertstand 'rgb' to
> mean.)

Neither numbers nor light intensities can by themselves be linear or
otherwise; only the relationship between the former and the latter can.

> The visual result is the same as in Photoshop in it's *gamma 1.0
> environment*.

If the numeric values and the relationship between them and light
intensities are the same, the light intensities are the same.

> So it seems logical to me that the initial <128,128,128> values in PS
> are 'linear' values, not sRGB values-- because using them as rgb in
> POV-ray (divided by 255) reproduces the identical visual result in
> BOTH gamma-1.0 environments... the 'linear' environments.

The initial <128, 128, 128> values are just numbers.  By themselves,
they don’t contain any information on whether they’re supposed to be
interpreted as light intensities encoded linearly or in any other
fashion, such as sRGB.  As you said, you can choose different ways to
interpret those values as light intensities—you do it by choosing the
working gamma space.

There’s nothing special about the linear relationship in this regard: if
you choose an arbitrary working gamma space in Photoshop, and use that
gamma value also as POV-Ray’s ‘assumed_gamma’, the visual result will be
the same, too.

> So going into in your IC app, and using the OPTIONS/BACKGROUND feature, I see
> the r-g-b sliders at '0.5' (by default.) I take that to mean "50% gray" in
> whatever sense or gamma environment is meant there...maybe gamma 1.0? So I
> compare the appearance of IC's generated 0.5 gray background with PS's 'gamma
> 1.0' appearance of <128,128,128>, and with POV-ray's   rgb <128,128,128>/255 at
> assumed_gamma 1.0. All three *look* identical to me, in their own
> environments.

Therefore, the relationship between numeric color values and light
intensities meant in that IC app is indeed linear—the assumed
gamma is 1.

> Yet IC reports its own '0.5' gray as being  'sRGB 187'. Not 128, as in
> Photoshop.  A calculation shows that 187/255  is approximately 128/255 to the
> power of 1/2.2. (I'm aware that  2.2 should actually be replaced with the more
> complex 'srgb' math equation.)

Exactly as it should be: the linear color components, in the 0–1 range,
are <0.5, 0.5, 0.5>; the sRGB components are <187, 187, 187>/255.
Now you’re considering one color and two different relationships between
it and the numeric values used to represent it, so those values are
different in each case.

> It's not clear to me yet what the discrepancy is
> as to why Photoshop reports 50% gray as <128,128,128>-- and *if* indeed those
> are supposed to be 'srgb' values rather than 'linear' like I thought--

You’ve already answered that yourself: Photoshop reports as <128, 128,
128> the gray you perceptually describe as 50% only when the chosen
working gamma space is the one that roughly matches your perception of
brightness; i.e., gamma 2.2.  Therefore, if you choose that working
gamma space, <128, 128, 128> are roughly the sRGB (similar to gamma 2.2)
values of the gray you see.  If you choose another working gamma space,
you’ll need numeric values different from <128, 128, 128> to get the
same gray, and those new values won’t be the gray’s sRGB values
any more.

> while IC reports <187,187,187> instead.

That’s a different gray.  Those were the sRGB components of the gray
which is half as bright as white physically (linear relationship), not
perceptually.


Post a reply to this message

From: Robert McGregor
Subject: Re: strange problem with srgb color in light_source
Date: 8 Apr 2021 17:45:00
Message: <web.606f793da9b7c95987570eabd4644d08@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> Cousin Ricky <ric### [at] yahoocom> wrote:
>
> > Wrong, wrong, wrong!

+10 for the Liam Neeson meme, nice one!


Post a reply to this message

From: Kenneth
Subject: Re: strange problem with srgb color in light_source
Date: 10 Apr 2021 09:10:00
Message: <web.6071a32aa9b7c959d98418916e066e29@news.povray.org>
I had to let all of the information here 'sink in' for a few days. Thanks for
all the patience and detailed breakdowns.  It's not easy to change my long-held
basic misconception, going back not just a week or month but for at least 10
years(!) I'm having flashes of insight about all of this... but then I sleep on
it and it disappears :-( I still have a few nagging questions-- but at this
point I might be perceived as the Devil come from Hell, to purposely sow discord
and confusion amongst the populace :-P

Well, it's always good to question one's beliefs, as painful as it can be. I'm
still putting all of the pieces together, to hopefully form a coherent and
crystal-clear understanding of the situation.

I repent!! I've seen the light!! (Sort of.) Please don't kill me :-O


Post a reply to this message

From: Thomas de Groot
Subject: Re: strange problem with srgb color in light_source
Date: 10 Apr 2021 11:37:01
Message: <6071c61d$1@news.povray.org>
Op 10-4-2021 om 15:07 schreef Kenneth:
> I had to let all of the information here 'sink in' for a few days. Thanks for
> all the patience and detailed breakdowns.  It's not easy to change my long-held
> basic misconception, going back not just a week or month but for at least 10
> years(!) I'm having flashes of insight about all of this... but then I sleep on
> it and it disappears :-( I still have a few nagging questions-- but at this
> point I might be perceived as the Devil come from Hell, to purposely sow discord
> and confusion amongst the populace :-P
> 
> Well, it's always good to question one's beliefs, as painful as it can be. I'm
> still putting all of the pieces together, to hopefully form a coherent and
> crystal-clear understanding of the situation.
> 
> I repent!! I've seen the light!! (Sort of.) Please don't kill me :-O
> 
> 

Kenneth, I am entirely with you. I have learned a lot from this 
discussion. Understanding fully needs time for me too.

-- 
Thomas


Post a reply to this message

From: Kenneth
Subject: Re: strange problem with srgb color in light_source
Date: 10 Apr 2021 13:30:00
Message: <web.6071e00da9b7c959d98418916e066e29@news.povray.org>
Thomas de Groot <tho### [at] degrootorg> wrote:
>
> Kenneth, I am entirely with you. I have learned a lot from this
> discussion. Understanding fully needs time for me too.
>

Thanks. It's at least nice to know that someone else was perhaps puzzling over
this entire crazy topic too.

For me, it's such a fundamental paradigm shift in my conception of things that
it's like I awoke one day to find that the sky is actually green, not blue like
I always thought. :-P

Just about the only thing I'm sure of at the moment is that I can take a color
from Photoshop, slap the 'srgb' keyword on it in POV-ray, and it looks like what
I expect to see! All the rest of this stuff keeps me awake at nights, wondering
where I went wrong...

But it's a good exercise for the ol' brain cells-- it keeps them active, ha.


Post a reply to this message

From: Mike Horvath
Subject: Re: strange problem with srgb color in light_source
Date: 12 May 2021 23:00:21
Message: <609c9645$1@news.povray.org>
On 4/1/2021 12:16 PM, Subclick wrote:
> Perhaps we could use a macro like this in the ‘colors.inc’ file:
> 
>    // Converts a color given in sRGB space to one in the ordinary RGB
>    // space determined by ‘assumed_gamma’.
>    #macro CsRGB2RGB(Color)
>      #local Result = srgbft Color
>      (Result)
>    #end
> 
> Now ‘#declare C4 = CsRGB2RGB(rgb <.5, .3, .7>)*50000;’ does work.
> 


If we removed the srgb keyword and forced users to use a macro or some 
other internal command like this, would it be more dummy-proof?



Mike


Post a reply to this message

From: Mike Horvath
Subject: Re: strange problem with srgb color in light_source
Date: 12 May 2021 23:03:26
Message: <609c96fe$1@news.povray.org>
On 5/12/2021 11:00 PM, Mike Horvath wrote:
> On 4/1/2021 12:16 PM, Subclick wrote:
>> Perhaps we could use a macro like this in the ‘colors.inc’ file:
>>
>>    // Converts a color given in sRGB space to one in the ordinary RGB
>>    // space determined by ‘assumed_gamma’.
>>    #macro CsRGB2RGB(Color)
>>      #local Result = srgbft Color
>>      (Result)
>>    #end
>>
>> Now ‘#declare C4 = CsRGB2RGB(rgb <.5, .3, .7>)*50000;’ does work.
>>
> 
> 
> If we removed the srgb keyword and forced users to use a macro or some 
> other internal command like this, would it be more dummy-proof?
> 
> 
> 
> Mike


I may end up using your macro regardless because I am a dummy.


Mike


Post a reply to this message

From: clipka
Subject: Re: strange problem with srgb color in light_source
Date: 26 May 2021 14:17:14
Message: <60ae90aa$1@news.povray.org>
Weeeeeell... Now that I've stuck my head back in here, you all know 
there is NO WAY that I can NOT chime in on this thread, even if I'm a 
little late to the party... so, where to start?

Am 07.04.2021 um 13:26 schrieb Kenneth:

> Well! Now we're getting somewhere. There *is* a major misunderstanding, although
> I'm not yet sure where. Here's my own breakdown and logic:

I guess I see where you're coming from. Here's the kicker: When we're 
talking about "linear color", what does "linear" even refer to?

"Linear" is always in reference to _something_, and when talking about 
brightness (of colour components or otherwise), that something could be 
either:


(1) physiological stimulus of the human visual system; as in, "this grey 
looks half as bright to me as that white piece of paper over there";

(2) raw color values; as in, "those are the numbers that Photoshop gives 
me";

(3) input signal for a classic CRT display; as in, "this is what I get 
if I set the input signal to 50mV";

-OR-

(4) physical light intensity, as in "this LED emits 1 mW of red light".


Most people never come into close contact with (3) or (4), and it so 
happens that (1) and (2) [in conventional computer graphics] are roughly 
proportional to each other. So for people dabbling with computer 
graphics, it is easy to conceptualize (1) and (2) as being exactly the 
same, and "the" reference system for brightness.

Even once you realize that (3) and (4) are also a thing, and that (1) 
and (2) may be quite dissimilar in modern computer graphics, it is easy 
to remain stuck in the concept of either (1) or (2) as being "the real 
deal".

In my experience, this is something you just have to snap out of, to get 
a true grasp of all the gamma shenanigans.


When people like Ive or me talk about "linear color values", we ALWAYS 
mean "linear with respect to PHYSICAL LIGHT INTENSITY".


There's one important reason why this is the "frame of reference" we're 
using: It is the ONLY one that is TRULY UNIVERSALLY FIXED.

(3) is an unstable reference, because no CRT (or any other analog) 
display responds to the same input signals in exactly the same manner. 
This is even true for CRTs of the same brand and model.

(2) is an unstable reference as well, because there are different 
standards as to what a value of e.g. 128 out of 255 really is supposed 
to indicate; that's what you see when

Even (1) is an unstable reference - possibly even the worst of all, as 
the human response to visual stimulus varies not only between people 
(think color blindness as an extreme case), but also depending on 
ambient viewing conditions, and whether you happen to have stared at a 
red or blue piece of cardboard just 20 seconds earlier.


Trying to get a grip on gamma while holding on to the color values in 
Photoshop as your frame of reference is like trying to build a mental 
picture of the solar system while holding on to a geocentric world 
model: It might seem intuitive, but you'll have to wreck your brain with 
complex and weird epicycle stuff, only to leave you with a bizarre 
picture that, although possibly of some practical use, remains 
incomprehensible at its core.

You have to smash that idea out of your head, and start fresh, putting 
the physical light intensity smack bang at the center of your world 
model, as the figurative sun.

Once you've done that, you can look back at good old Earth (read: 
Photoshop color values), and see how - and why - that is itself a moving 
target, just like all other pieces in the puzzle that is gamma handling.


(And once you've gotten there, you'll realize that there's a whole 
galaxy out there, and that even "linear RGB values" in the physical 
light intensity sense aren't really a static thing either. Welcome to 
the world of metamerism, color models, gamuts, dynamic ranges, and 
what-have-yous.)


Well, I'm starting(?) to ramble. The takeaway message is this:

Photoshop color values are NOT THE LINEAR THING. They're fluid. They're 
subject to interpretation. They're just binary codes - bit patterns that 
have no meaning until some meaning is assigned to them. Even the numeric 
representation presented by Photoshop should be considered little more 
than a courtesy for humans, so that they don't have to memorize long 
sequences of ones and zeros.

"50% Grey" is NOT THE LINEAR THING either (unless in a program 
implemented by Ive, of couse ;) ). It is fluid. It is subject to 
individual perception, surrounding colors, and what you've stared at for 
breakfast. And don't you dare call it "middle grey", or you'll start a 
flame war of epic proportions.

THE TRUE LINEAR THING is the stream of photons that your screen emits 
when it displays an image. Or the stream of photons that enters a camera 
when it takes a picture. Physical light intensity.


Unfortunately, physical light intensity isn't trivial to produce or 
measure reliably. However, there's one potentially eye-opening 
experiment that should work reasonably well with most displays:

- Start Photoshop or the like, and create a new image with exactly the 
same number of pixels as your display.
- Painstakingly paint the entire image with alternating rows of black 
and white pixels. Make sure the white rows are truly white, and the 
black rows are truly black.
- Display the image in fullscreen mode.

There. You've turned half of your display's pixels to 100% brightness, 
and the other half to 0% brightness. The average physical light 
intensity of your display is now exactly(*) the arithmetic mean of the 
physical light intensities of your display's white and your display's 
"black".

(*Well, roughly, to be fair. Depending on display type, there might be 
some slight "bleeding" effects between pixels that can skew the result a 
bit.)

Now you can draw rectangles of uniform grey color onto that image, and 
see which one - when squinting your eyes - best blends with the striped 
background. The color of THAT rectangle you're seeing is true 50% 
physical light intensity grey. (And no, those values Photoshop is 
showing you, they ARE NOT that color. It is additional context that 
under certain circumstances makes them CORRESPOND TO that color.)


Once you've accepted Physical Light Intensity as your One And Only 
God... oh wait, no, that's the wrong text...

... anyway, once you've gotten to THAT point, you can actually start 
unraveling mysteries like "then what do the Photoshop values even mean?"


In a nutshell, those "Photoshop values" boil down to, "well, we want our 
images to be not just black and white, so we'll add 254 distinct steps 
of brightness in between. Somewhere. Wherever. Doesn't matter much, as 
long as the hardware is cheap to build. It's not like anyone would ever 
want to do _computations_ on images, right? That would be ridiculous. 
We'll worry about precise specifications later, when everyone has gotten 
accustomed to it and thinks there's any system to this madness."

It was only when that madness had blown up in people's faces that they 
started thinking about standardizing those brightness steps, and some 
de-facto standards emerged from the ashes. Multiple different ones, of 
course, because a single one would have made life too easy.

You can choose which of these standards Photoshop should follow, by 
changing the gamma settings. By tweaking this setting, you change which 
set of Photoshop values CORRESPONDS TO a certain color.


In a similar vein, you can look at all the other color-related 
components in the whole system: The color value system used by POV-Ray's 
parser, the color value system used in the render engine, the color 
value system used in file formats, and actually a host of other little 
puzzle pieces - all of which can only be brought together properly if 
you use physical light intensity as the one immovable fulcrum of the 
whole thing.


There. I guess I've rambled enough for a single post. More thoughts on 
this thread later.


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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