|
 |
kurtz le pirate <kur### [at] gmail com> wrote:
> Hello,
>
> Let's assume that we have a colors map :
> #declare MyColorMap = color_map {
> [ 0.00 rgb < 1.00, 0.00, 0.00> ]
> [ 0.50 rgb < 1.00, 1.00, 0.00> ]
> [ 1.00 rgb < 0.00, 0.00, 1.00> ]
> }
>
> Is there a way to recover the color for specific index ?
> Something that looks like : GetColor(MyColorMap, index)
Sure - I think you could take something like a gradient pigment pattern, apply
that color mapping to it, and then use that as a function. Then you could pass
in a space coordinate with a vector component parallel to that gradient, and the
function would return the interpolated color vector as a result.
You would of course, have to write / generate 3 functions - one for the .r, .g,
and .b components.
https://wiki.povray.org/content/Reference:Color_Map
Alternatively, you could roll your own and use a spline function to do the
interpolation, in case there something special that the above can't handle.
Post a reply to this message
|
 |