POV-Ray : Newsgroups : povray.general : Rendering colors outside of RGB space Server Time
5 Nov 2024 05:24:43 EST (-0500)
  Rendering colors outside of RGB space (Message 1 to 10 of 21)  
Goto Latest 10 Messages Next 10 Messages >>>
From: epidot
Subject: Rendering colors outside of RGB space
Date: 8 Apr 2009 07:10:00
Message: <web.49dc85bda5d3a765fb42379f0@news.povray.org>
Is there anyway to render a colour that is outside the normal RGB space?

I have a situation where I have some colour data that falls outside the RGB
gamut. It would be very good to get your input on this


Post a reply to this message

From: clipka
Subject: Re: Rendering colors outside of RGB space
Date: 8 Apr 2009 08:25:00
Message: <web.49dc9329469723b6f3b4f0@news.povray.org>
"epidot" <nomail@nomail> wrote:
> Is there anyway to render a colour that is outside the normal RGB space?
>
> I have a situation where I have some colour data that falls outside the RGB
> gamut. It would be very good to get your input on this

(A) No, it's not possible. POV simply operates in RGB space.

(B) Then again, that's "almost not true": POV's rendering engine actually knows
nothing about color space - it just operates on a 3-band spectral space, which
happens to be typically used as R, G and B respectively. Well, it *almost*
knows nothing about it: There are a few operations that deal with the overall
brightness, which is computed from the three spectral bands, weighting them in
a way custom-tailored to RGB.

(C) IIUC colors outside the gamut can be achieved by "boosting" some of the RGB
components beyond 100% (effectively enlarging the "gamut triangle" in all
directions). AFAIK POV is perfectly fine operating with such high numbers
(though there are a few places where you can deliberately clip colors), and
even writes them to suitable file formats, such as HDR. So yes, you can render
those - you just can't properly display them on a computer screen for obvious
reasons.


Post a reply to this message

From: Ive
Subject: Re: Rendering colors outside of RGB space
Date: 8 Apr 2009 14:19:54
Message: <49dceaca@news.povray.org>
clipka wrote:
> "epidot" <nomail@nomail> wrote:
>> Is there anyway to render a colour that is outside the normal RGB space?
>>
>> I have a situation where I have some colour data that falls outside the RGB
>> gamut. It would be very good to get your input on this
> 
> (C) IIUC colors outside the gamut can be achieved by "boosting" some of the RGB
> components beyond 100% (effectively enlarging the "gamut triangle" in all
> directions). AFAIK POV is perfectly fine operating with such high numbers
> (though there are a few places where you can deliberately clip colors), and
> even writes them to suitable file formats, such as HDR. So yes, you can render
> those - you just can't properly display them on a computer screen for obvious
> reasons.
> 

Wrong. Out of gamut values are indicated by one or more RGB components 
with *negative* values. It has nothing to do with HDR. And IIRC POV-Ray 
does clip negative values - but it is a long time since I looked at the 
source - so you might know better.

-Ive


Post a reply to this message

From: clipka
Subject: Re: Rendering colors outside of RGB space
Date: 8 Apr 2009 15:05:01
Message: <web.49dcf506469723b6f3b4f0@news.povray.org>
Ive <"ive### [at] lilysoftorg"> wrote:
> Wrong. Out of gamut values are indicated by one or more RGB components
> with *negative* values. It has nothing to do with HDR. And IIRC POV-Ray
> does clip negative values - but it is a long time since I looked at the
> source - so you might know better.

Well, if RGB components can be negative, then obviously we're not talking about
a straightforward 3-band spectrum (or am I missing something here?) as
simulated by POV-Ray.

So there's two things involved here:

(1) A rendering engine, simulating three spectral bands (which, for physical
reasons, cannot have negative intensity), and

(2) the human visual system, partially mixing these spectral bands for a certain
color perception (due to the receptor pigments' spectral response ranges
overlapping).

So I think there cannot be an unsurmountable problem with the render engine -
only with how to present the results to the human eye.

There *is* of course the problem that the render engine's spectral bands are by
convention assumed to be identical to the emission spectrum of the user's
display's phosphors. However, this is not a necessity.

So the right thing to do would be to (A) choose properly defined spectral bands,
(B) make sure color values are coded accordingly, and (C) apply some
transformation to the output to transform the quite arbitrary 3-band image into
a target color space of choice.

If this still yields inferior results, there would still be the possibility to
model a larger number of spectral bands, using macros to define the colors, and
and render the scene in multiple passes, picking three of those bands per pass.
Again, the results would have to be transformed into the desired color space.


Post a reply to this message

From: Ive
Subject: Re: Rendering colors outside of RGB space
Date: 8 Apr 2009 16:39:03
Message: <49dd0b67$1@news.povray.org>
clipka wrote:

> Well, if RGB components can be negative, then obviously we're not talking about
> a straightforward 3-band spectrum (or am I missing something here?) as
> simulated by POV-Ray.
> 

POV-Ray might want to use a straightforward 3-band spectrum (e.g. for 
dispersion calculation) but this is not how it works. It would be true 
if you define indeed *all* colors within your pigment statements as 
components from a 3-band spectrum but who does this?
POV simply works with what you feed in. I guess much more common are RGB 
values that are represented by the sRGB color space. But the RGB 
components from sRGB are not meant to be a 3-band spectrum (and I'm not 
talking about gamma here).
The same is true for the Wide-Gamut colorspace, Adobe RGB and what not...

Let me put it this way: what *color* is actually meant by rgb <1,0,0>
- and do not just tell me it's red - I know that ;)

Sorry, I'm really a bit in a hurry right now, but I will remember this
and we might discuss this later...

-Ive


Post a reply to this message

From: clipka
Subject: Re: Rendering colors outside of RGB space
Date: 8 Apr 2009 20:35:00
Message: <web.49dd4212469723b6a08de100@news.povray.org>
Ive <"ive### [at] lilysoftorg"> wrote:
> POV-Ray might want to use a straightforward 3-band spectrum (e.g. for
> dispersion calculation) but this is not how it works. It would be true
> if you define indeed *all* colors within your pigment statements as
> components from a 3-band spectrum but who does this?

.... which is just what I'm saying: Use it in the right way, and you can do
out-of-RGB-gamut stuff with it.

BTW, color values in POV are typically interpreted by the engine to be linear,
and are therefore not sRGB anyway (which does not only exactly define the
primaries, but also uses some gamma stuff).


Post a reply to this message

From: MessyBlob
Subject: Re: Rendering colors outside of RGB space
Date: 8 Apr 2009 22:40:01
Message: <web.49dd5ff3469723b6addfbead0@news.povray.org>
There are two ways of looking at this 'out of gamut' question: wavelengths, and
brightness (amplitudes). It's possible to have wavelengths that don't exist in
POV-Ray, and amplitudes that are too bright for integer (8-bit or 16-bit)
output from POV-Ray.


First, the frequency perspective:

There's a difference between real life light and the RGB representation. If you
have a real-world monochromatic colour that has a single spectral peak
somewhere between the wavelengths of green and red, then we'd see (perceive) it
as 'orange' or 'yellow'.

In RGB, we represent this colour in terms of the spectral responses that
redd-ish, green-ish, and blue-ish receptors would give, provided the receptors
had a reasonably wide frequency response (like those in the eye), so it would
be 'red + green' (a response in red, and a response in green).

As it stands, POV-Ray light acts like all light consists only of three
monochoromatic peaks: R, G, and B, centred on frequencies of red, green, and
blue. It's sufficient for most purposes, but effects like diffraction,
refraction, dispersion, diffusion, scattering, quantum interference, and true
transmission (with different alpha values at different wavelengths) can only be
done realistically in the frequency domain, with all ray calculations using
amplitude information for all frequencies (in the relevant range).

It's possible to write a rendering engine that carries frequency-domain values
for each ray, but it would take a huge re-write for POV-Ray to work this way,
and the benefits would be minimal and the penalites high. Even then, it's only
a part of the way towards simulating how light really really propagates... but
like I said, RGB is sufficient for most purposes.


The brightness (amplitude) perspective is a bit easier to understand:

I think POV-Ray clips on output, unless you're using HDR or floating-point file
format. I tend to use a line like
  #declare Exposure = 1.0;
and then use Exposure to scale the colour of lights and ambient objects.

This allows you to set the exposure of the scene, just like one would use
'exposure compensation' on a digital camera. This can help ensure all levels
are <1.0. For example, if a scene renders twice as bright as you want it to be,
then set Exposure to 0.5. With 16-bit PNG output, this should be suitable for
most visual output.

If you're using the output for data, rather than visual images, then that's
another matter.


Post a reply to this message

From: Ive
Subject: Re: Rendering colors outside of RGB space
Date: 9 Apr 2009 03:31:00
Message: <49dda434@news.povray.org>
MessyBlob wrote:
> There are two ways of looking at this 'out of gamut' question: wavelengths, and
> brightness (amplitudes). It's possible to have wavelengths that don't exist in
> POV-Ray, and amplitudes that are too bright for integer (8-bit or 16-bit)
> output from POV-Ray.
> 
> 
> First, the frequency perspective:
> 
[snip...]

This is all true but has nothing to do with the color space gamut.


> The brightness (amplitude) perspective is a bit easier to understand:
> 
[snip...]

Again, true but not related to the color space gamut.

-Ive


Post a reply to this message

From: Ive
Subject: Re: Rendering colors outside of RGB space
Date: 9 Apr 2009 03:40:48
Message: <49dda680$1@news.povray.org>
clipka wrote:
> Ive <"ive### [at] lilysoftorg"> wrote:
>> POV-Ray might want to use a straightforward 3-band spectrum (e.g. for
>> dispersion calculation) but this is not how it works. It would be true
>> if you define indeed *all* colors within your pigment statements as
>> components from a 3-band spectrum but who does this?
> 
> .... which is just what I'm saying: Use it in the right way, and you can do
> out-of-RGB-gamut stuff with it.
>

...which is not true *if* negative values are clipped - as I sayd.


> BTW, color values in POV are typically interpreted by the engine to be linear,
> and are therefore not sRGB anyway (which does not only exactly define the
> primaries, but also uses some gamma stuff).
> 

No need to tell me trivial things, as I sayd, I was *not* talking about 
gamma, so let's use the the scRGB color space (the sRGB primaries but 
with linear gamma) for that matter.

-Ive


Post a reply to this message

From: Ive
Subject: Re: Rendering colors outside of RGB space
Date: 9 Apr 2009 03:53:36
Message: <49dda980@news.povray.org>
epidot wrote:
> Is there anyway to render a colour that is outside the normal RGB space?
> 
> I have a situation where I have some colour data that falls outside the RGB
> gamut. It would be very good to get your input on this
> 
> 

OK, I finally have just tried it and it does indeed work if you do use 
the OpenEXR output - which is available within the POV-Ray 3.7 beta 
version. In any other case POV-Ray just clips the RGB components and 
does *not* apply any gamut mapping.

-Ive


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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