|
|
Le 22/07/2017 à 00:28, jr a écrit :
> hi,
>
> 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.
>
You can try this :
// --- build colors map ---------------------------------
#declare colorStart = <1.00, 0.00, 0.00>; // Red
#declare colorEnd = <0.00, 0.00, 1.00>; // Blue
#declare colorDelta = colorEnd - colorStart;
#declare nStep = 64; // or others values
#declare colorStep = colorDelta/(nStep);
#declare myMap = color_map {
#declare index = 0;
#while (index <= nStep)
#declare c = colorStart + index*colorStep;
#declare s = index/nStep;
[ s rgb c]
#declare index=index+1;
#end
}
// --- use colors map --------------------------------
box {
<0, 0, 0>,< 5, 5, 100>
pigment {
gradient z
color_map { myMap }
scale <1,1,100>
}
}
--
Kurtz le pirate
Compagnie de la Banquise
Post a reply to this message
|
|