POV-Ray : Newsgroups : povray.binaries.images : Bezier pigment colours Server Time
2 Oct 2024 08:14:46 EDT (-0400)
  Bezier pigment colours (Message 1 to 8 of 8)  
From: Tor Olav Kristensen
Subject: Bezier pigment colours
Date: 2 Jun 2000 11:48:33
Message: <3937D74E.8B3772EB@hotmail.com>
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] hotmailcom
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

Preview of image 'bezierpigment03.jpg'
bezierpigment03.jpg


 

From: Bob Hughes
Subject: Re: Bezier pigment colours
Date: 2 Jun 2000 17:32:52
Message: <39382804$1@news.povray.org>
"Tor Olav Kristensen" <tor### [at] hotmailcom> 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

From: Rune
Subject: Re: Bezier pigment colours
Date: 2 Jun 2000 20:02:46
Message: <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.)

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

From: Margus Ramst
Subject: Re: Bezier pigment colours
Date: 2 Jun 2000 21:41:36
Message: <3938542B.7BD55CD1@peak.edu.ee>
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

From: Bob Hughes
Subject: Re: Bezier pigment colours
Date: 2 Jun 2000 23:54:21
Message: <3938816d$1@news.povray.org>
"Rune" <run### [at] inamecom> 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

From: Rune
Subject: Re: Bezier pigment colours
Date: 3 Jun 2000 06:12:37
Message: <3938da15@news.povray.org>
"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

From: Tor Olav Kristensen
Subject: Re: Bezier pigment colours
Date: 3 Jun 2000 17:54:56
Message: <39397EBE.708E1620@hotmail.com>
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] hotmailcom
http://www.crosswinds.net/~tok/tokrays.html


Post a reply to this message

From: Margus Ramst
Subject: Re: Bezier pigment colours
Date: 4 Jun 2000 12:12:28
Message: <393A6542.AB73B22A@peak.edu.ee>
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] peakeduee
TAG (Team Assistance Group) e-mail: mar### [at] tagpovrayorg


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.