[Radiance-general] Custom false color palette
Ilya A. Zimnovich
webmaster at audice.com
Thu Sep 18 13:37:50 PDT 2008
Hello Dave,
I'm not sure this will help you, but in our "posterize" script which may
be downloaded from here:
http://www.bakharev.org/index.php?option=com_content&task=view&id=33&lang=english
we used this CAL-code:
=================================
min : $min ;
max : $max ;
step : $step ;
scale : $max-$min ;
clip(x) : if(x-1,1,if(x,x,0));
render(x) = floor((x-min)/step)*step/scale;
{render(x) = (x-min)/scale;}
interp_arr10(x, arr) = ( (x-floor(x)) *
arr(ceil(x)+1)-arr(floor(x)+1)) / 1 ) + arr(floor(x)+1);
interp_arr(x, arr) = interp_arr10(x*10, arr);
def_red(x) = interp_arr(x, def_red_arr);
def_grn(x) = interp_arr(x, def_grn_arr);
def_blu(x) = interp_arr(x, def_blu_arr);
def_red_arr(i) : select(i,
.03,.17,.31,.45,.57,.67,.76,.84,.90,.97,.99 );
def_grn_arr(i) : select(i,
.10,.21,.32,.43,.53,.60,.69,.78,.87,.96,.99 );
def_blu_arr(i) : select(i,
.27,.34,.41,.47,.53,.58,.64,.74,.85,.95,.96 );
in = 1;
ro = if(in, def_red(clip(render(v))), rorig);
go = if(in, def_grn(clip(render(v))), gorig);
bo = if(in, def_blu(clip(render(v))), borig);
=================================
Where you can implement your own palette by changing these lines:
...select(i, .03,.17,.31,.45,.57,.67,.76,.84,.90,.97,.99 );
...select(i, .10,.21,.32,.43,.53,.60,.69,.78,.87,.96,.99 );
...select(i, .27,.34,.41,.47,.53,.58,.64,.74,.85,.95,.96 );
Best Regards,
Ilya A. Zimnovich
David Smith wrote:
> I'm trying to make a false color / pseudo color image that matches the
> color palette from a non-lighting program. It would work great with
> four nested IF statements, but falsecolor -r/g/b doesn't seem to want
> to take them. Has anybody come up with a workaround for this or am I
> better off editing the falsecolor script?
>
> Perhaps there is a way to use higher order functions?
>
> Here's an image of the scale and a close numerical pseudocolor
> traversal: http://tinyurl.com/4e2x7m
>
> This would be the if statement for the falsecolor -r argument:
> if(v-5/7,1,if(v-4/7,7v-4,if(v-2/7,0,if(v-1/7,2-7v,7v))))
>
> --Dave
>
> _______________________________________________
> Radiance-general mailing list
> Radiance-general at radiance-online.org
> http://www.radiance-online.org/mailman/listinfo/radiance-general
>
More information about the Radiance-general
mailing list