|
|
jr <cre### [at] gmailcom> wrote:
>
> can someone please point me to a color_map example which provides a
> smooth blend/gradient from (ideally) blue at 0 to red at 1 in 254
> increments? I'd prefer a solution which does not require (an array of)
> named colours.
>
> thank you, jr.
Thinking ahead here: You are welcome!
You will probably get the idea from my fast example. Funny thing, still took me
half hour to write and edit again and again! I wanted it to do stepped colors
too, and comment on parts.
Bob
P.S. you can ignore the "by bob", no need to keep that. :)
/* SIMPLE SPECIFIC NUMBER OF COLORS FOR A GRADIENT PATTERN by bob */
#declare BeginColorCount=1; // or zero and < EndColorCount
#declare EndColorCount=254; // or > BeginColorCount
#declare StepsCount=12; // number to increment by (1 is good too)
box { // apply to this shape
0.00001,0.99999 // unequalize surface and color map
pigment {
gradient x // choose a directional axis
//ramp_wave // default
color_map {
#for (It,BeginColorCount,EndColorCount,StepsCount)
[
It/EndColorCount, (It+StepsCount)/EndColorCount
color rgb <(EndColorCount-It)/EndColorCount,0,It/EndColorCount>
color rgb <(EndColorCount-It)/EndColorCount,0,It/EndColorCount>
]
#end
}
}
finish {
ambient 1 emission 0 diffuse 0 // see it without light
}
translate -0.5 // center on origin vector
scale 2 // double unit size
rotate <30,30,30> // change orientation
translate <0,0,4> // move location
}
Post a reply to this message
|
|