|
![](/i/fill.gif) |
"SharkD" <nomail@nomail> wrote:
> Nicolas Alvarez <nic### [at] gmail com> wrote:
> > SharkD wrote:
> > > I generated the following heightfield in some program or other. It uses
> > > all 24 bits for elevation information. My question is, how are the
> > > colors/height data organized? I would like to create a pigment that
> > > produces similar maps.
> >
> > Seems similar to the POV-Ray TGA heightfields, except using all three
> > channels instead of two.
> >
> > Basically, red*256*256 + green*256 + blue = 24-bit grayscale value.
>
> How would I create this type of pigment? Thanks.
>
> -Mike
OK, here's the pigment:
#local hf_pigment_function_pow = function {y * pow(256,3)}
#local hf_pigment_function_b = function {mod(hf_pigment_function_pow(x,y,z),
pow(256,1))}
#local hf_pigment_function_g = function {mod(hf_pigment_function_pow(x,y,z) -
hf_pigment_function_b(x,y,z), pow(256,2))}
#local hf_pigment_function_r = function {mod(hf_pigment_function_pow(x,y,z) -
hf_pigment_function_b(x,y,z) - hf_pigment_function_g(x,y,z), pow(256,3))}
#local hf_pigment_b = pigment
{
function {hf_pigment_function_b(x,y,z) / pow(256,1)}
color_map {[0 rgb 0][1 rgb z]}
}
#local hf_pigment_g = pigment
{
function {hf_pigment_function_g(x,y,z) / pow(256,2)}
color_map {[0 rgb 0][1 rgb y]}
}
#local hf_pigment_r = pigment
{
function {hf_pigment_function_r(x,y,z) / pow(256,3)}
color_map {[0 rgb 0][1 rgb x]}
}
// This is the one you want
#local hf_pigment_rgb = pigment
{
average
pigment_map {[3 hf_pigment_b][3 hf_pigment_g][3 hf_pigment_r]}
}
Post a reply to this message
|
![](/i/fill.gif) |