![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
I wanted to get smoother transisions (no "banding")
between the different colours in a pigment color_map.
A macro I made generates the different colour entries
for the color_map.
Here's two images rendered with the code below.
Any comments ?
Are there other ways to get smooth transitions
between colours in a color_map ?
Tor Olav
--
mailto:tor### [at] hotmail com
http://www.crosswinds.net/~tok/tokrays.html
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
#version 3.1;
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
#macro Bezier(TT, StartPoint, StartVector, EndPoint, EndVector)
#local aa = 2*StartPoint - 2*EndPoint + 3*StartVector - 3*EndVector;
#local bb = -3*StartPoint + 3*EndPoint - 6*StartVector + 3*EndVector;
#local cc = 3*StartVector;
#local dd = StartPoint;
(((aa*TT + bb)*TT + cc)*TT + dd)
#end // macro Bezier
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
#declare FirstColour = <0.5, 0.0, 0.0>;
#declare FirstDirection = <4.0, 1.0, 0.0>;
#declare LastDirection = <0.0, 1.0, 1.0>;
#declare LastColour = <0.0, 0.0, 0.5>;
#declare Bright = 0.3;
/* // Also try this
#declare FirstColour = < 2, 0, 0>;
#declare FirstDirection = < 0, 2, 0>;
#declare LastDirection = < 0, -1, 1>;
#declare LastColour = < 0, 0, 1>;
#declare Bright = 0.5;
*/
#declare NrOfEntries = 100; // min 2, max 256
#declare BezierMap =
color_map {
#declare TT = 0;
#while (TT < 1)
[ TT rgb Bright*Bezier(TT,
FirstColour, FirstDirection,
LastDirection, LastColour) ]
#declare TT = TT + 1/NrOfEntries;
#end // while
}
#declare BezierPigment =
pigment {
// bozo
gradient y
turbulence 0.3
color_map { BezierMap }
}
sky_sphere { pigment { BezierPigment } }
light_source { <0, 0, 0> color 1.5*<1, 1, 1> }
camera {
location <1, 0, 0>
look_at <0, 0, 0>
angle 120
}
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7
Post a reply to this message
Attachments:
Download 'bezierpigment02.jpg' (11 KB)
Download 'bezierpigment03.jpg' (9 KB)
Preview of image 'bezierpigment02.jpg'
![bezierpigment02.jpg](/povray.binaries.images/attachment/%3C3937D74E.8B3772EB%40hotmail.com%3E/bezierpigment02.jpg?preview=1)
Preview of image 'bezierpigment03.jpg'
![bezierpigment03.jpg](/povray.binaries.images/attachment/%3C3937D74E.8B3772EB%40hotmail.com%3E/bezierpigment03.jpg?preview=1)
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Tor Olav Kristensen" <tor### [at] hotmail com> wrote in message
news:3937D74E.8B3772EB@hotmail.com...
|
| I wanted to get smoother transisions (no "banding")
| between the different colours in a pigment color_map.
|
| Are there other ways to get smooth transitions
| between colours in a color_map ?
By using 'sine_wave' in it, if I understand right.
Bob
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Bob Hughes" wrote:
> "Tor Olav Kristensen" wrote:
> | I wanted to get smoother transisions (no "banding")
> | between the different colours in a pigment color_map.
> |
> | Are there other ways to get smooth transitions
> | between colours in a color_map ?
>
> By using 'sine_wave' in it, if I understand right.
That only works if you have 2 colors in the color_map only.
One color at 0.0 and the other at 1.0
Currently the linear interpolation between colors are the only one available
as far as I know. (The different wave-types does not change this.)
Greetings,
Rune
---
Updated April 25: http://rsj.mobilixnet.dk
Containing 3D images, stereograms, tutorials,
The POV Desktop Theme, 350+ raytracing jokes,
miscellaneous other things, and a lot of fun!
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Tor Olav Kristensen wrote:
>
> Any comments ?
>
I'd like to see some way to specify color_map indices in the macro call.
Perhaps have the macro take an array as a parameter. Something like:
array[6][Number of indices]
{
{Position, StartP, StartV, EndP, EndV, Nr_of_entries},
{Position, StartP, StartV, EndP, EndV, Nr_of_entries},
...
}
> Are there other ways to get smooth transitions
> between colours in a color_map ?
>
MegaPOV has built-in spline functions. They work very much like your
macro, but IIRC only linear and cubic splines are supported. The basic
method would still have to be the same, though.
Margus
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Rune" <run### [at] iname com> wrote in message
news:39384b26@news.povray.org...
| "Bob Hughes" wrote:
| > "Tor Olav Kristensen" wrote:
| > | I wanted to get smoother transisions (no "banding")
| > | between the different colours in a pigment color_map.
| > |
| > | Are there other ways to get smooth transitions
| > | between colours in a color_map ?
| >
| > By using 'sine_wave' in it, if I understand right.
|
| That only works if you have 2 colors in the color_map only.
| One color at 0.0 and the other at 1.0
|
| Currently the linear interpolation between colors are the only one available
| as far as I know. (The different wave-types does not change this.)
Good point. A 'blend' keyword would be great.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Bob Hughes" wrote:
> "Rune" wrote:
> | "Bob Hughes" wrote:
> | > "Tor Olav Kristensen" wrote:
> | > | I wanted to get smoother transisions (no "banding")
> | > | between the different colours in a pigment color_map.
> | > |
> | > | Are there other ways to get smooth transitions
> | > | between colours in a color_map ?
> | >
> | > By using 'sine_wave' in it, if I understand right.
> |
> | That only works if you have 2 colors in the color_map only.
> | One color at 0.0 and the other at 1.0
> |
> | Currently the linear interpolation between colors are the
> | only one available as far as I know. (The different
> | wave-types does not change this.)
>
> Good point. A 'blend' keyword would be great.
I agree, that would be a very nice feature.
Greetings,
Rune
---
Updated April 25: http://rsj.mobilixnet.dk
Containing 3D images, stereograms, tutorials,
The POV Desktop Theme, 350+ raytracing jokes,
miscellaneous other things, and a lot of fun!
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Margus Ramst wrote:
>
> I'd like to see some way to specify color_map indices in the macro call.
> Perhaps have the macro take an array as a parameter. Something like:
>
> array[6][Number of indices]
> {
> {Position, StartP, StartV, EndP, EndV, Nr_of_entries},
> {Position, StartP, StartV, EndP, EndV, Nr_of_entries},
> ...
> }
Would this be for assembling the color_map from several
Bezier coloured "bands" ?
> > Are there other ways to get smooth transitions
> > between colours in a color_map ?
>
> MegaPOV has built-in spline functions. They work very much like your
> macro, but IIRC only linear and cubic splines are supported. The basic
> method would still have to be the same, though.
Useful feature !
Thank you for answering.
Tor Olav
--
mailto:tor### [at] hotmail com
http://www.crosswinds.net/~tok/tokrays.html
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Tor Olav Kristensen wrote:
>
> Would this be for assembling the color_map from several
> Bezier coloured "bands" ?
>
Yes. To go, let's say, from blue to red to green in your colour map.
--
Margus Ramst
Personal e-mail: mar### [at] peak edu ee
TAG (Team Assistance Group) e-mail: mar### [at] tag povray org
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |