|
|
"Bald Eagle" <cre### [at] netscapenet> wrote:
> 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.
Like this:
#version 3.8;
global_settings {
assumed_gamma 1.0
}
#include "math.inc"
#declare E = 0.000001;
#declare Camera_Orthographic = true; //
<----################################################################################
#declare Camera_Position = <0, 0, -20>; // front view
#declare Camera_Look_At = <0, 0, 0> ;
#declare Fraction = 1; // functions as a zoom for the orthographic view: 4
zooms in 4x, 8 zooms in 8x, etc.
#declare Aspect = image_width/image_height;
// ###########################################
camera {
#if (Camera_Orthographic = true)
orthographic
right x*image_width/(Fraction)
up y*image_height/(Fraction)
#else
right x*image_width/image_height
up y
#end
location Camera_Position
look_at Camera_Look_At}
// ###########################################
sky_sphere {pigment {rgb 1}}
light_source {<0, 0, -image_width> color rgb 1}
#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> ]
}
#declare Gradient = pigment {gradient x color_map {MyColorMap}}
box {<0, image_height/3, 0>, < image_width, 2*image_height/3, 0.01> pigment
{Gradient scale image_width} translate -x*image_width/2}
#declare GradientFunction = function {pigment {Gradient}}
#for (XX, 16, 640-16, 16)
#local R = GradientFunction (XX/image_width, 0, 0).red;
#local G = GradientFunction (XX/image_width, 0, 0).green;
#local B = GradientFunction (XX/image_width, 0, 0).blue;
sphere {<XX, 0, 0> 5 pigment {rgb <R, G, B>} translate -x*image_width/2}
#end
Post a reply to this message
Attachments:
Download 'colormapinterpolation.png' (18 KB)
Preview of image 'colormapinterpolation.png'
|
|