POV-Ray : Newsgroups : povray.newusers : How do I add color to "sphere_sweep"? : Re: How do I add color to "sphere_sweep"? Server Time
6 Oct 2024 02:43:14 EDT (-0400)
  Re: How do I add color to "sphere_sweep"?  
From: Alex
Date: 12 Aug 2009 05:40:00
Message: <web.4a828deaff67402bdb8ca50@news.povray.org>
"Chris B" <nom### [at] nomailcom> wrote:
> "Alex" <ale### [at] hotmailcom> wrote in message
> news:web.4a82745d1c23c4f8db8ca50@news.povray.org...
> > Hi,
> >
> > How can I add 'true-indexed' RGB color to each point along a
> > "sphere_sweep"
> > object? In other words, if this "sphere_sweep" object is defined by N
> > points, I
> > would like to be able to specify N RGB colors.
> >
> > Many thanks in advance for helping me out!
> >
> > Cheers,
> > Alex
> >
>
> I don't think there's an easy way of doing exactly that. OTOH you can do
> something equivalent using splines and a #while loop quite easily. The
> spline example below is taken straight from the spline section in the help
> and illustrates using different colors along the length of an object created
> using lots of spheres (in this case about 100). It shouldn't be too
> difficult to adapt that to do something equivalent to what you ask.
>
> camera {location <-1, 1,-1> look_at <0,0,0>}
> light_source {<1,10,-1> color rgb 1}
>
> #declare MySpline = spline {
>   cubic_spline
>   -.25, <0,0,-1>
>   0.00, <1,0,0>
>   0.25, <0,0,1>
>   0.50, <-1,0,0>
>   0.75, <0,0,-1>
>   1.00, <1,0,0>
>   1.25, <0,0,1>
> }
>
> #declare ctr = 0;
> #while (ctr < 1)
>   sphere {
>     MySpline(ctr),.25
>     pigment { rgb <1-ctr,ctr,0> }
>   }
>   #declare ctr = ctr + 0.01;
> #end
>
>
> Regards,
> Chris B.

Thanks Chris,

Some follow up questions:

* In the documentation, I cannot really find any info on the first parameter of
the spline function (-.25, 0.00, etc.). What does is do? With sphere_sweep I
don't need to define these values...

* I already have predefined matrices (N x 3) of colors and of "sphere widths".
How do I add them to the scene (instead of calculating them on the fly)?

* I am also worried about efficiency, as I am modelling many objects of this
kind: let's say 10000 "hyperstreamtubes" (a sphere_sweep object with variable
width), with each these consisting of 100 points. Here you can see an example:
http://www.exploredti.com/gallery/gof_2.htm

Cheers,
-A


Post a reply to this message

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