POV-Ray : Newsgroups : povray.general : strange problem with srgb color in light_source Server Time
2 May 2024 16:47:11 EDT (-0400)
  strange problem with srgb color in light_source (Message 43 to 45 of 45)  
<<< Previous 10 Messages Goto Initial 10 Messages
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.