|
![](/i/fill.gif) |
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
|
![](/i/fill.gif) |