|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Ray-tracers,
How do I translate colors from HTML format, i.e. color="#D5EAFF" to POV
format?
I, like any newbie, figured that D5 (213 in decimal) divided by 256 is 0.832
and likewise, EA becomes 0.914. I naturally then tried
pigment { rgb <0.832 , 0.914, 1> }
and got a lovely gray nothing like the dull blue of my web page. I would
like to make dull blue buttons to match the dull blue of the page (I didn't
choose the dull blue for the web page, that's what the boss likes).
Thanks,
Hershel
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hershel Robinson wrote:
>
> Ray-tracers,
>
> How do I translate colors from HTML format, i.e. color="#D5EAFF" to POV
> format?
>
> I, like any newbie, figured that D5 (213 in decimal) divided by 256 is 0.832
> and likewise, EA becomes 0.914. I naturally then tried
Sorry, but you have to divide by 255 (not 256).
Pure White is 255, and in pov it's 1.
>
> pigment { rgb <0.832 , 0.914, 1> }
Unless the ambient is 1 (which is not the default),
the texture will only reflect part of the light it get,
multiplying by the pigment
(a reflected <1,1,1> would get out as desired, but it rarely
happen)
Moreover, there is a gamma correction applied to the pov-output.
The default gamma is 2.2 (unless, like me, you have a custom built
pov so as to get a default gamma of 1,
but then you wouldn't have posted here)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> Moreover, there is a gamma correction applied to the pov-output.
> The default gamma is 2.2 (unless, like me, you have a custom built
> pov so as to get a default gamma of 1,
> but then you wouldn't have posted here)
>
To get a gamma 1, just leave out assumed_gamma 1 from the default
settings.
Ingo
--
Photography: http://members.home.nl/ingoogni/
Pov-Ray : http://members.home.nl/seed7/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Kari Kivisalo wrote:
>
> Hershel Robinson wrote:
>
> > How do I translate colors from HTML format, i.e. color="#D5EAFF" to POV
> > format?
>
> #declare AG=1;
> #global_settings{assumed_gamma AG}
>
> #macro G(Color)
> #local DisplayGamma=2.2; // Display_Gamma from povray.ini
> #local Gamma=DisplayGamma/AG;
> <pow(Color.x,Gamma),pow(Color.y,Gamma),pow(Color.z,Gamma)>
> #end
>
> #macro H2D(Hex)
> #local H=strupr(Hex)
> #local D1=asc(substr(H,1,1))-65;
> #local D2=asc(substr(H,1,1))-65;
> (D1<0 ? D1+17 : D1+10)*16 + (D2<0 ? D2+17 : D2+10)
> #end
>
> #macro Hex2Color(C)
> (<H2D(substr(C,1,2)),H2D(substr(C,3,2)),H2D(substr(C,5,2))>/255)
> #end
>
> camera{location -3*z look_at 0}
>
> box{-1,1
> pigment{rgb G(Hex2Color("D5EAFF"))}
> finish{diffuse 0 ambient 1}
> }
If that is your idea of a new user solution I would hate to see what you
provide for an advanced user :)
--
Ken Tyler
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Ken wrote:
>
> > [...]
> > #local DisplayGamma=2.2; // Display_Gamma from povray.ini
> > [...]
>
> If that is your idea of a new user solution I would hate to see what you
> provide for an advanced user :)
The same, but without the comment... ;)
--
Jaime Vives Piqueres
La Persistencia de la Ignorancia
http://www.ignorancia.org/
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Ken wrote:
>
> If that is your idea of a new user solution I would hate to see what you
> provide for an advanced user :)
Well, it works. The new version at least. I deleted the one you quoted
because of error in H2D().
_____________
Kari Kivisalo
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Hershel Robinson wrote:
>
> How do I translate colors from HTML format, i.e. color="#D5EAFF" to POV
> format?
When assumed_gamma isn't used drop G() because it's not needed.
Hex2Color does straight html color to pov color conversion.
#declare AG=1;
#global_settings{assumed_gamma AG}
#macro G(Color)
#local DisplayGamma=2.2; //Display_Gamma from povray.ini
#local Gamma=DisplayGamma/AG;
<pow(Color.x,Gamma),pow(Color.y,Gamma),pow(Color.z,Gamma)>
#end
#macro H2D(Hex)
#local H=strupr(Hex)
#local D1=asc(substr(H,1,1))-65;
#local D2=asc(substr(H,2,1))-65;
(D1<0 ? D1+17 : D1+10)*16 + (D2<0 ? D2+17 : D2+10)
#end
#macro Hex2Color(C)
(<H2D(substr(C,1,2)),H2D(substr(C,3,2)),H2D(substr(C,5,2))>/255)
#end
camera{location -3*z look_at 0}
box{-1,1
pigment{rgb G(Hex2Color("D5EAFF"))}
finish{diffuse 0 ambient 1}
}
_____________
Kari Kivisalo
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Thank you Kari for the detailed and reusable answer.
<editorial comments>
> If that is your idea of a new user solution I would hate to see what you
> provide for an advanced user :)
I am a new user to POV-Ray, but Kari probably noted that I mentioned that I
am a programmer so I actually appreciate the thorough answer.
</editorial comments>
Hershel
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Kari Kivisalo wrote:
>
> #macro G(Color)
> #local DisplayGamma=2.2; //Display_Gamma from povray.ini
> #local Gamma=DisplayGamma/AG;
> <pow(Color.x,Gamma),pow(Color.y,Gamma),pow(Color.z,Gamma)>
> #end
Here is a demo that shows how G() preserves colors when assumed_gamma
is used. Without G() gamma correction is applied twice to the colors
so they loose saturation and contrast.
http://www.pp.htv.fi/kkivisal/gamma_colors.jpg
When you design a cool color layout in an image editor the colors
you are viewing are gamma corrected. When assumed_gamma (1) is
present povray applies gamma correction to the whole image and
also to your carefully selected colors (which were already corrected).
G() macro applies inverse correction which cancels the povray gamma
correction. Or, as I like to say, converts a color to linear space :)
_____________
Kari Kivisalo
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Jaime Vives Piqueres" <jai### [at] ignoranciaorg> wrote in message
news:3B7931DD.EAA07078@ignorancia.org...
>
> The same, but without the comment... ;)
LOL
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|