POV-Ray : Newsgroups : povray.newusers : gradient question : Re: gradient question Server Time
4 Nov 2024 21:22:14 EST (-0500)
  Re: gradient question  
From: Trevor Quayle
Date: 19 Sep 2001 16:12:29
Message: <3ba8fc2d$1@news.povray.org>
I used your code and modified it slightly to run a whole bunch of cylinders
with random endpoints.  I'll post my image in p.b.i for you.  If you can see
your problem with it maybe can can explain it a bit more carefully.  (BTW
the speckles on the ends of the cylinder come from the gradient having
coincident surfaces where it is repeating, multiply the scale factor by
something miniscule like 1.00001 to get rid of it)

code used:

camera {
  up y
  right x*image_width/image_height
  location <0,0,-10>
  look_at < 0,0,0>
}

light_source {
  <0,100,-10>
  color rgb <1,1,1>
}

background {color rgb 1}


#declare R1=seed(1);

#declare i = -5;
#while (i<=5)
  #declare j = -3;
  #while (j<=3)
    #declare p1 = <-1*rand(R1),-1*rand(R1),-1*rand(R1)>*5*(rand(R1)-0.5);
    #declare p2 = <1*rand(R1),1*rand(R1),1*rand(R1)>*5*(rand(R1)-0.5);
    cylinder{
      p1, p2, 0.2
      texture{
        pigment{
          gradient (p2-p1)
          color_map{
             [0.0 color rgb <1, 0, 0>]
             [1.0 color rgb <0, 0, 1>]
          }
        }
        scale vlength(p2-p1)
        translate p1
        finish {
          ambient 0.8
          diffuse 0.5
          specular 0.1
          roughness 0.01
        }
      }
      translate x*i+y*j
    }
    #declare j=j+1;
  #end
  #declare i=i+1;
#end


-tgq


Post a reply to this message

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