|
|
I suggest you use this interpolation macro, it's very flexible:
//Interpolation
//GC - global current
//GS - global start
//GE - global end
//TS - target start
//TE - target end
//EXP - interpolation exponent (linear, cubic etc.)
#macro Interpolate(GC,GS,GE,TS,TE,EXP)
(TS+(TE-TS)*pow((GC-GS)/(GE-GS),EXP))
#end
Do something like this:
#declare StartColor=<1,1,0>;
#declare EndColor=<0,1,0>;
#declare N=10;
#declare C=0;
#while(C<10)
sphere{y*C, 0.5
pigment{rgb Interpolate(C,0,N,StartColor,EndColor,1)}
}
#declare C=C+1;
#end
Here, pigment changes from StartColor to EndColor as C changes from 0 to N. The
final parameter is 1, meaning linear interpolation.
I use this macro extensively, even though this particular example could be
achieved more efficiently.
Margus
Noah A wrote:
>
> i'm using a while statment to make a bunch of "things" as they rise on
> the y access i'd like them to incease certain colors. how would i use an
> array to do this?
Post a reply to this message
|
|