|
|
Am 09.09.2011 16:27, schrieb Thomas de Groot:
> Is it possible one way or another, to determine/calculate the srgb
> equivalent of a given rgb vector? and vice-versa of course?
>
This is surely possible but the way it is done depends on what you
actually mean by 'rgb'.
Assuming you mean the rgb color space that is using the same primaries
as sRGB but is in linear space (i.e scRGB) all you need is a gamma
transformation like:
#declare sRGB_Gamma = function(C) {
select(C-0.0031308, C*12.92 : 1.055*pow(C,1/2.4)-0.055)
}
and the inverse for sRGB -> scRGB:
#declare sRGB_GammaInverse = function(C) {
select(C-0.04045, C/12.92, pow((C+0.055)/1.055,2.4))
}
Assuming both input and output within 0.0 - 1.0 range.
Now just write macros that do handle the 3 color channels with these
functions but keep filter and transmit values untouched.
Otherwise (when you are not referring to scRGB) you'll need to transform
it via CIE xyz color space where my CIE.inc file should come in handy.
-Ive
P.S. untested code as I do not have POV-Ray available atm.
Post a reply to this message
|
|