POV-Ray : Newsgroups : povray.binaries.images : Placing random spheres (~330k in attachments) : Re: Placing random spheres (~330k in attachments) Server Time
7 Aug 2024 07:13:34 EDT (-0400)
  Re: Placing random spheres (~330k in attachments)  
From: Zeger Knaepen
Date: 16 May 2006 08:17:53
Message: <4469c2f1$1@news.povray.org>
"Warp" <war### [at] tagpovrayorg> wrote in message 
news:446997bb$1@news.povray.org...
>    Oops, I had an error in my description: It was the *diameter*, not
> the radius of the spheres which were 0.2 and 0.23.
> 
>    Anyways, with a small change I got the time for the spheres of
> diamater 0.2 reduced to 15 seconds and the time for the ones of
> diamater 0.23 to 1:50.

quite a difference :)

best I could come up with, is more or less the naive way, where I, in a 
way, let POV-Ray itself check the intersections, instead of doing the 
checks in POV-SDL:

-- begin code --
camera {
 location <1,8,4>*2
 look_at 0
}
light_source {<75,180,500> rgb 1}
#declare Seed=seed(354);
#declare MinCoords=<-10,0,-10>;
#declare MaxCoords=<10,0,10>;
#macro Location()
 #local R=MinCoords+(MaxCoords-MinCoords)*<rand(Seed), 0, rand(Seed)>;
 R
#end
#declare TestTexture=sphere {MaxCoords*10,.01}

#declare Count=5000;
#declare Radius=.1;

#while (Count>0)
 #local Loc=Location();
 #if (inside(TestTexture,Loc)=0)
  sphere {Loc,Radius pigment {rgb <rand(Seed),rand(Seed),rand(Seed)>} 
finish {ambient .25 specular 1}}
  #declare TestTexture=union {object{TestTexture} sphere 
{Loc,Radius*2}}
  #declare Count=Count-1;
  //#debug concat(str(Count, 0, 0)," to go\n")
 #end
#end
-- end code --

takes 1'30" for a diameter of .2 and 6'51" for a diameter of .23

(but I only have an athlon xp 2500+ :))

cu!
-- 
#macro G(b,e)b+(e-b)*C/50#end#macro _(b,e,k,l)#local C=0;#while(C<50)
sphere{G(b,e)+3*z.1pigment{rgb G(k,l)}finish{ambient 1}}#local C=C+1;
#end#end _(y-x,y,x,x+y)_(y,-x-y,x+y,y)_(-x-y,-y,y,y+z)_(-y,y,y+z,x+y)
_(0x+y.5+y/2x)_(0x-y.5+y/2x)            // ZK http://www.povplace.com


Post a reply to this message

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