POV-Ray : Newsgroups : povray.general : Sphere sweep with color gradient Server Time
1 Nov 2024 01:21:26 EDT (-0400)
  Sphere sweep with color gradient (Message 1 to 3 of 3)  
From: Dudo
Subject: Sphere sweep with color gradient
Date: 25 Oct 2016 06:50:01
Message: <web.580f37ec9429c9ef2571926e0@news.povray.org>
Hi,

how can I put a color gradient along the sphere sweep path?
I have seen such visualizations in VMD..

Thanks
D.


Post a reply to this message

From: clipka
Subject: Re: Sphere sweep with color gradient
Date: 25 Oct 2016 07:01:50
Message: <580f3b9e$1@news.povray.org>
Am 25.10.2016 um 12:46 schrieb Dudo:

> how can I put a color gradient along the sphere sweep path?
> I have seen such visualizations in VMD..

IIRC you'll currently need to resort to HgPovray; Jerome implemented
sphere sweep UV mapping there a while ago, but AFAIR it hasn't been
carried over to official POV-Ray (yet).


Post a reply to this message

From: JimT
Subject: Re: Sphere sweep with color gradient
Date: 27 Oct 2016 11:05:01
Message: <web.581217794891bb9ebe7517870@news.povray.org>
"Dudo" <nomail@nomail> wrote:
> Hi,
>
> how can I put a color gradient along the sphere sweep path?
> I have seen such visualizations in VMD..
>
> Thanks
> D.

I can't put a colour gradient on a sphere sweep either. The following changes
the colour along a spline curve of constant radius. If you want the radius to
change, you should use a roundcones rather than cylinders. I can help you with
that if you want.

#include "colors.inc"
//
global_settings {max_trace_level 5}

background{White}

camera {orthographic location <3,1,0> look_at <0,1,0>}

light_source {<-140,200,300> rgb <1, 1, 1>*1.5}
light_source {<140,200,-300> rgb <0.9, 0.9, 1.00>*0.8 shadowless}
//
// Define a spline
//
#declare MySpline1 =
  spline {
// Smooth flowing curve. My favourite.
    natural_spline
//
    -.25, <0,0,-1>
    0.00, <1,0,0>
    0.25, <0,0.25,1>
    0.50, <-1,0.5,0>
    0.75, <0,0.75,-1>
    1.00, <1,2,0>
    1.25, <0,2,1>
  }
//
// Calculate the pigment
//
#macro MyPig(ctt)
   #if (ctt < 0.5)
     #local rr = 1;
     #local gg = 2*ctt;
   #else
     #local rr = 2*(1-ctt);
     #local gg = 1;
   #end
   <rr,gg,0>
#end
//
//Path of the Spline
//
union{
  #declare ctr = 0;
  #declare oldpos = MySpline1(ctr);
  sphere{oldpos 0.1 pigment{ rgb MyPig(ctr) } }
  #while (ctr < 1)
    #declare ctr = ctr + 0.002;
    #declare newpos = MySpline1(ctr);
    cylinder{oldpos, newpos 0.1 pigment { rgb MyPig(ctr) } }
    sphere{newpos 0.1 pigment { rgb MyPig(ctr) } }
    #declare oldpos = newpos;
  #end
     }


Post a reply to this message

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