POV-Ray : Newsgroups : povray.general : color mixing tool Server Time
30 Jul 2024 06:18:32 EDT (-0400)
  color mixing tool (Message 11 to 13 of 13)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: scott
Subject: Re: color mixing tool
Date: 30 Nov 2009 06:10:39
Message: <4b13a82f$1@news.povray.org>
> Sometimes when I need a real-life color, I will open a photo with 
> IrfanView and click on the color I want, to read the RGB values. I take 
> those values and convert them in POV like so:
>
> rgb <128,96,250>/256

You do realise that photos are usually in sRGB colour space and POV expects 
linear colour values?  By simply pasting the numbers into POV the colours in 
the resulting image are going to be washed out and probably of the incorrect 
hue...

Better to do a simple inverse gamma correction inside POV (the 2.2 here 
roughly approximates the sRGB -> linear conversion):

rgb <pow(128/255,2.2),pow(96/255,2.2),pow(250/255,2.2)>

That way the colours in your POV output image should match much better what 
you picked in the first place.


Post a reply to this message

From: Thomas de Groot
Subject: Re: color mixing tool
Date: 1 Dec 2009 03:42:33
Message: <4b14d6f9$1@news.povray.org>
"scott" <sco### [at] scottcom> schreef in bericht 
news:4b13a82f$1@news.povray.org...
> You do realise that photos are usually in sRGB colour space and POV 
> expects linear colour values?  By simply pasting the numbers into POV the 
> colours in the resulting image are going to be washed out and probably of 
> the incorrect hue...
>
> Better to do a simple inverse gamma correction inside POV (the 2.2 here 
> roughly approximates the sRGB -> linear conversion):
>
> rgb <pow(128/255,2.2),pow(96/255,2.2),pow(250/255,2.2)>
>
> That way the colours in your POV output image should match much better 
> what you picked in the first place.
>

This may even be true (in my experience) with any color picker external to 
POV-Ray. Bearing that in mind, I wrote a little macro using your line of 
code:

#macro ColorCorrect(ColorIn)
  rgb <pow(ColorIn.red/255, 2.2), pow(ColorIn.green/255, 2.2), 
pow(ColorIn.blue/255, 2.2)>
#end

Which you can use then whenever you pick an external color, e.g.:

#declare ColorIn = <0.0,  128,  128>; //the color picked externally
sphere {
  0.0, 1
  texture {
    pigment {ColorCorrect(ColorIn) }
    finish{
      specular 0.2
      roughness 0.001
    }
  }
}

Thomas


Post a reply to this message

From: scott
Subject: Re: color mixing tool
Date: 10 Dec 2009 10:43:58
Message: <4b21173e@news.povray.org>
> This may even be true (in my experience) with any color picker external to 
> POV-Ray.

Yes mine too, actually I first came across this (a long time ago) when 
trying to put a POV generated file into a power point presentation.  The 
colour of the main object in the POV file was meant to exactly match some 
corporate colour already used in the PPT (as RGB of course).

> Bearing that in mind, I wrote a little macro using your line of code:
>
> #macro ColorCorrect(ColorIn)
>  rgb <pow(ColorIn.red/255, 2.2), pow(ColorIn.green/255, 2.2), 
> pow(ColorIn.blue/255, 2.2)>
> #end

That's a neat idea.  I think there was a discussion a while back about 
having another SDL keyword to specify that literal colours and image maps 
are to be interpreted as sRGB rather than linear values.


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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