POV-Ray : Newsgroups : povray.general : srgb vs. rgb for *every* color in v3.7xx? Server Time
23 Dec 2024 12:16:38 EST (-0500)
  srgb vs. rgb for *every* color in v3.7xx? (Message 1 to 9 of 9)  
From: Kenneth
Subject: srgb vs. rgb for *every* color in v3.7xx?
Date: 15 Feb 2016 07:50:00
Message: <web.56c1c87e9d15cd5733c457550@news.povray.org>
I've been kind of confused for awhile about just where and when to use srgb
colors in my scenes since v3.7 came out. (Assume that I'm using assumed_gamma
1.0 and that I'm already using srgb colors for OBJECTS.) The docs mention using
srgb "everywhere that color literals are used", but it's not clear (to me) what
other things in the scene require them, in order for all elements to be
*consistent*, both visually and for POV-Ray to work correctly.

Should I also use it in lights, media, etc. etc.? In other words, for
*everything* that uses a color? There's a big visual difference when using rgb
vs. srgb in lights, for example.

AFAIU, v3.7 always uses 'linear' values in its computations now-- for correct
physical behavior-- regardless of whether rgb or srgb is specified in a scene.

So is my question really just a matter of 'visual or artistic preference' rather
than computational consistency? Or, are there some things in POV-Ray that should
*not* use srgb at all?


Post a reply to this message

From: scott
Subject: Re: srgb vs. rgb for *every* color in v3.7xx?
Date: 15 Feb 2016 08:32:01
Message: <56c1d351$1@news.povray.org>
> Should I also use it in lights, media, etc. etc.? In other words, for
> *everything* that uses a color? There's a big visual difference when using rgb
> vs. srgb in lights, for example.

It depends where you get the numbers from that you are using.

If you are just making them up to get something that looks nice, it 
doesn't matter.

If you've picked the colour from PowerPoint, from a webpage or whatever 
and you want to match that colour, use srgb. Eg you like the look of 
(255,164,40) in PowerPoint, and you want your light that colour, use 
srgb <255,164,40>/255

If you want to control the physical amount of light in known ratios, use 
rgb. Eg you want twice as much red than green, use rgb <1,0.5,0>, or 
maybe you have some scientific measurement data in linear RGB (or you 
can convert easily to linear RGB) that you want to use.


Post a reply to this message

From: Kenneth
Subject: Re: srgb vs. rgb for *every* color in v3.7xx?
Date: 15 Feb 2016 09:50:00
Message: <web.56c1e45ae2de51bf33c457550@news.povray.org>
scott <sco### [at] scottcom> wrote:
> > Should I also use it in lights, media, etc. etc.? In other words, for
> > *everything* that uses a color? There's a big visual difference when using rgb
> > vs. srgb in lights, for example.
>

.... and I forgot to mention ambient light and emission.

> It depends where you get the numbers from that you are using.
>
> If you are just making them up to get something that looks nice, it
> doesn't matter.
>

Here's what seems to be a kind of 'unknown' (from a practical standpoint of just
creating 'artistically pleasing' scenes, not necessarily scientifically-accurate
ones.)

Using a light as an example:
Let's say I have an object with an srgb color of <.3,.5,.7>, and I include a
light from 3.7's 'insert menu' which has rgb as a color type. A LINEAR color, as
far as I know. I make the light's color <.2,1,.4>. That will produce a final
visual color on the object of some particular hue, saturation and brightness.
Hopefully, it will match what I had in my mind's eye (assuming that I have some
knowledge of color mixing.)

At this point, I naively assume that the color I see (its HSB) is the 'correct'
color under that lighting condition (IF I could reference some kind of color
chart to compare it to.) But, not having such a reference, I don't know for
sure.

Now I change the light's color to srgb-- which produces a *different* final HSB
(due to the gamma curve now being applied to BOTH the light's color and the
object's color.)

So I need to make a choice about the light, of which color type to use. Yet, I
don't know which of the object's final HSB values is the truly correct one,
given the vector colors I've chosen.


Post a reply to this message

From: Mike Horvath
Subject: Re: srgb vs. rgb for *every* color in v3.7xx?
Date: 15 Feb 2016 11:21:38
Message: <56c1fb12$1@news.povray.org>
On 2/15/2016 7:45 AM, Kenneth wrote:
> I've been kind of confused for awhile about just where and when to use srgb
> colors in my scenes since v3.7 came out. (Assume that I'm using assumed_gamma
> 1.0 and that I'm already using srgb colors for OBJECTS.) The docs mention using
> srgb "everywhere that color literals are used", but it's not clear (to me) what
> other things in the scene require them, in order for all elements to be
> *consistent*, both visually and for POV-Ray to work correctly.
>
> Should I also use it in lights, media, etc. etc.? In other words, for
> *everything* that uses a color? There's a big visual difference when using rgb
> vs. srgb in lights, for example.
>
> AFAIU, v3.7 always uses 'linear' values in its computations now-- for correct
> physical behavior-- regardless of whether rgb or srgb is specified in a scene.
>
> So is my question really just a matter of 'visual or artistic preference' rather
> than computational consistency? Or, are there some things in POV-Ray that should
> *not* use srgb at all?
>
>

This is a confusing question that I don't know the answer to either.


Mike


Post a reply to this message

From: clipka
Subject: Re: srgb vs. rgb for *every* color in v3.7xx?
Date: 15 Feb 2016 14:59:59
Message: <56c22e3f$1@news.povray.org>
Am 15.02.2016 um 13:45 schrieb Kenneth:
> I've been kind of confused for awhile about just where and when to use srgb
> colors in my scenes since v3.7 came out. (Assume that I'm using assumed_gamma
> 1.0 and that I'm already using srgb colors for OBJECTS.) The docs mention using
> srgb "everywhere that color literals are used", but it's not clear (to me) what
> other things in the scene require them, in order for all elements to be
> *consistent*, both visually and for POV-Ray to work correctly.

I'm not sure where you got that quote from; I just searched the Wiki
(which includes the text of the docs) and couldn't find it anywhere.

I suspect you extrapolated that from statements saying something like:

"When converting an old scene to assumed_gamma 1.0, replace rgb with
srgb everywhere."

There is NO requirement whatsoever that a scene must use "srgb" instead
of "rgb" for physical realism.

The "srgb" keyword is just for convenience of entering colours that you
get from somewhere else: PhotoShop's colour picker, the World Wide Web,
or even a 3.6 POV-Ray scene without explicit assumed_gamma. What all
these sources have in common is that they typically use some non-linear
representation of colour values, often closely matching the sRGB colour
space. Most notably, sRGB is the official standard for the Web.

You can consider "srgb C" shorthand for

    rgb <f_srgb(C.red),f_srgb(C.green),f_srgb(C.blue)>

where f_srgb(x) is the so-called "sRGB transfer function" defined in the
sRGB standard, being approximately (but exactly) equal to exp(x,2.2).

If you're already using "assumed_gamma 1.0", and have found a colour
that you think looks great with "rgb", by all means do NOT replace it
with "srgb".


> Should I also use it in lights, media, etc. etc.? In other words, for
> *everything* that uses a color? There's a big visual difference when using rgb
> vs. srgb in lights, for example.

There is, indeed. That is why there is both the "srgb" and "rgb" keywords.

> AFAIU, v3.7 always uses 'linear' values in its computations now-- for correct
> physical behavior-- regardless of whether rgb or srgb is specified in a scene.

That is correct (presuming you use a "#version 3.7" statement and don't
explicitly specify an assumed_gamma other than 1.0). The only difference
between the two is that if you use "rgb", POV-Ray presumes the data
specified to be linear already and will use it as-is, while if you use
"srgb", POV-Ray presumes the data to be sRGB and will apply the
corresponding conversion first.

> So is my question really just a matter of 'visual or artistic preference' rather
> than computational consistency? Or, are there some things in POV-Ray that should
> *not* use srgb at all?

I wouldn't call it "visual or artistic preference", but rather
"technical preference" -- for each "srgb" colour there is a matching
"rgb" colour (albeit with different values) and vice versa, so there is
no result you can achieve with either keyword that you cannot achieve
with the other keyword; "all" you need to do is change the data
accordingly (except for values of 0.0 or 1.0, which happen to stay the
same).


For light sources I would typically recommend using "rgb", as you may
want to adjust the light source's brightness by multiplying with a
constant factor, like this:

    light_source {
      <X,Y,Z>
      rgb <R,G,B> * BRIGHTNESS
    }

As this multiplication is applied /before/ conversion, the same
construct with "srgb" will NOT increase the brightness by a factor of
BRIGHTNESS, but by some much larger factor, and may even result in a
colour shift.

Alternatively, use:

    #declare LightColour = srgb <R,G,B>;
    light_source {
      <X,Y,Z>
      LightColour * BRIGHTNESS
    }


Post a reply to this message

From: clipka
Subject: Re: srgb vs. rgb for *every* color in v3.7xx?
Date: 15 Feb 2016 15:36:10
Message: <56c236ba@news.povray.org>
Am 15.02.2016 um 20:58 schrieb clipka:

> You can consider "srgb C" shorthand for
> 
>     rgb <f_srgb(C.red),f_srgb(C.green),f_srgb(C.blue)>
> 
> where f_srgb(x) is the so-called "sRGB transfer function" defined in the
> sRGB standard, being approximately (but exactly) equal to exp(x,2.2).

make that "(but NOT exactly)"...


Post a reply to this message

From: scott
Subject: Re: srgb vs. rgb for *every* color in v3.7xx?
Date: 17 Feb 2016 04:34:38
Message: <56c43eae$1@news.povray.org>
> So I need to make a choice about the light, of which color type to use. Yet, I
> don't know which of the object's final HSB values is the truly correct one,
> given the vector colors I've chosen.

Well you've chosen two different physical light colours (the fact you 
defined one with srgb and one with rgb is not really relevant). Neither 
one is more "correct" than the other, unless you got the numbers from 
somewhere where they had some prior meaning (eg from a colour picker 
tool, or from some scientific measurement data).


Post a reply to this message

From: Kenneth
Subject: Re: srgb vs. rgb for *every* color in v3.7xx?
Date: 17 Feb 2016 10:00:00
Message: <web.56c48932e2de51bf33c457550@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 15.02.2016 um 13:45 schrieb Kenneth:
> > The docs mention using srgb "everywhere that color literals are used"...
>
> I'm not sure where you got that quote from; I just searched the Wiki
> (which includes the text of the docs) and couldn't find it anywhere.
>
> I suspect you extrapolated that from statements saying something like:
>
> "When converting an old scene to assumed_gamma 1.0, replace rgb with
> srgb everywhere."

Yes, it was probably here (about migrating old scenes to v3.7)...
http://wiki.povray.org/content/HowTo:Fix_old_scenes_to_work_with_the_new_gamma_system

" 3. Gamma-adjust all colour literals, by raising the R,G,B components to the
power of 2.2 (or wait for the next beta, and use "srgb" instead of "rgb")."

I thought I had seen it elsewhere, in another context, but I can't find it.

>
> There is NO requirement whatsoever that a scene must use "srgb" instead
> of "rgb" for physical realism.
>
> The "srgb" keyword is just for convenience of entering colours that you
> get from somewhere else: PhotoShop's colour picker, the World Wide Web,
> or even a 3.6 POV-Ray scene without explicit assumed_gamma.
> (... etc.)

Yes, I've understood that for several years now, and that 'srgb' is optional.

>
> > So is my question really just a matter of 'visual or artistic preference'
> > rather than computational consistency? Or, are there some things in POV-Ray
> > that should *not* use srgb at all?
>
> I wouldn't call it "visual or artistic preference", but rather
> "technical preference" -- for each "srgb" colour there is a matching
> "rgb" colour (albeit with different values) and vice versa...
>
> For light sources I would typically recommend using "rgb"...
>

Hmm, I might disagree with that (but for reasons that aren't purely technical.)

Just to give some background: In the v3.61 and 3.62 days, I used assumed_gamma
2.2 for all my scenes (right or wrong), because it gave me the light-and-object
colors that I was used to seeing and using in Photoshop (and many other apps)
operating in their own 2.2 gamma-adjusted color space. (I don't think I was
alone in this.) Actually, I chose 2.2 *solely* because assumed_gamma 1.0
resulted in 'washed out' colors-- washed out according to what I was expecting.
(At the same time, I didn't really grasp the difference between 'physically
correct' lighting using assumed_gamma 1.0, vs. what I was doing.)

But I finally realized my *major* mistake: the COLORS I was choosing simply
needed to be re-worked for assumed_gamma 1.0, in order to get the 'same'
rendered colors I had seen before. To do that in a practical way, one of two
things was required: picking colors visually from a 'different kind' of color
palette-- a fanciful one, a 'linear' one, what I called a 'gamma 1.0 color
picker' at the time-- OR, adjusting the colors' vector components with a 2.2
power law. All of that seemed rather cumbersome, so I happily stuck with
assumed_gamma 2.2-- in the face of much contrary criticism. ;-)

Then along comes v3.7, with its optional 'srgb' colors (plus various gamma
corrections) to solve this problem. (And to help me understand how/why I had
been wrong about my previous dislike of assumed_gamma 1.0.)

However...
Creating new scenes in v3.7 and using RGB for all colors (along with
assumed_gamma 1.0) requires thinking purely in 'linear' color terms. The trouble
is, I still *think* about colors and color-mixing in terms of the gamma 2.2
world-- and that world covers just about every graphics application we know of.
(I envy anyone who can think in a 'linear color' way.)

I had a pretty good 'feel' for how to mix numerical colors in POV-Ray's vectors
prior to v3.7. Now, when using an object with srgb colors, but a light with rgb
(linear) colors, I need to think in terms of the light's 'linear' color palette,
which isn't easy; and chances are, the final color 'mix' in the preview will no
longer match my intuition.

OBJECT colors are easy to choose (using srgb). The LIGHT's color is not so easy,
because light isn't a physical thing to *see* (unless I attach a looks_like
object to it), and it *interacts* with the object's color, shadows, etc.

That was the real point of my question.

At this point-- and I could be wrong again-- I think I'll use srgb for BOTH
things (and for everything else where color is used), solely for visual and
intuitive understanding . At least, until I get a better feel for v3.7xx's many
new color and gamma features.


Post a reply to this message

From: clipka
Subject: Re: srgb vs. rgb for *every* color in v3.7xx?
Date: 17 Feb 2016 18:06:19
Message: <56c4fceb@news.povray.org>
Am 17.02.2016 um 15:55 schrieb Kenneth:

> I had a pretty good 'feel' for how to mix numerical colors in POV-Ray's vectors
> prior to v3.7. Now, when using an object with srgb colors, but a light with rgb
> (linear) colors, I need to think in terms of the light's 'linear' color palette,
> which isn't easy; and chances are, the final color 'mix' in the preview will no
> longer match my intuition.

I that case, "srgb" is indeed the way to go.


Post a reply to this message

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