POV-Ray : Newsgroups : povray.general : pipe_spline and color : Re: pipe_spline and color Server Time
3 Jul 2024 03:36:00 EDT (-0400)
  Re: pipe_spline and color  
From: Alain
Date: 29 Nov 2015 17:39:57
Message: <565b7ebd@news.povray.org>

> Hi Alain,
>
> That is precisely what I need. If I could make use of the length parameter along
> the spline, I could define the pigment at every such position. In the short code
> I posted, you can see in the #macro that the radius of my pipe_spline is defined
> by the parameter sClock - the radius is proportional to the position along the
> spline. I want to do the same thing for color, but it seems the parameter sClock
> does not work there. I suspect that it would be possible if I invoked the
> parameter correctly.
>
> - Alex
>
>
>
>

You can have something like:
color_map{[0 rgb 1][sClock rgb<1,0,0>][1 rgb<0,1,1>]}

with the value of sClock previously declared, as long as sClock range 
from 0 to 1, both inclusive.

You may define additional splines that define your colours, say 
Colour_Spline. That way, you can use:

#declare Something = pigment{rgb Colour_Spline[sClock]}
or
#declare Something = pigment{rgbft<Red_Spline[sClock], 
Green_Spline[sClock], Blue_Spline[sClock], Filter_Spline[sClock], 
Transmit_Spline[sClock]}

Here, if sClock's value is outside the range of the spline, the result 
is taken at the nearest end.

Then, it's possible to construct a colour_map in a loop:

colour_map{
#declare Point = 0;
#while(Point <= 1)
  [Point rgb Colour_Spline[Point]]
#declare Point = Point + 0.01;
#end
}


Alain


Post a reply to this message

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