POV-Ray : Newsgroups : povray.general : Realy uniform points on sphere : Re: Realy uniform points on sphere Server Time
2 Aug 2024 10:22:38 EDT (-0400)
  Re: Realy uniform points on sphere  
From: Thies Heidecke
Date: 22 Nov 2004 04:22:36
Message: <41a1afdc$1@news.povray.org>
"Rafal 'Raf256' Maj" <spa### [at] raf256com> schrieb im Newsbeitrag
news:Xns95A6A03392860raf256com@203.29.75.35...
>
> Hi,
Hi

> is there a macro to place points realy uniformly (in almost distances from
> each point to it's neighbours)?
As the others said, there are only approximations possible for arbitrary
large numbers of points.

> VRand_On_Sphere() places each point correclty, but it doesnt care about
> other points, so when used in loop - the resulting _group_ of points isnt
> so uniformly placed.
>
> This problem is simmilar to finding good points/vectors to be used in
> radiosity directions AFAIK (but it's about full sphere, not half of it).

Sorry if i'm annoying anyone with repeatedly stating the usefulness
of the golden-ratio-approach ; ) ... but i use it with good results.
It's not perfect and probably optimizing the positions with an
electrostatic-repulsion approach can give more optimal results but
i think this method is by far the fastest and for many points it gives
nice results.

Greetings,
Thies


Here's my approach:

#version 3.5;

global_settings {
  assumed_gamma 1.0
  max_trace_level 5
}

camera {
  location  <1.3, 3.5, -1.0>
  direction 1.5*z
  right     x*image_width/image_height
  look_at   <0.0, 0.0,  0.0>
}
sky_sphere {
  pigment {
    gradient y
    color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [0.7 rgb <0.0,0.1,0.8>]
    }
  }
}
light_source {
  <-20, 30, -60>
  color rgb <0.9, 0.7, 0.3>
}
light_source {
  <70, 40, 80>
  color rgb <0.1, 0.3, 0.9>
}

#declare N  = 5000; // Number of Spheres
#declare M  = N;
#declare sr = 0.8 * 2/sqrt(N);  // sphereradius
#declare phi= 0;
#declare gsa= 360*((sqrt(5)-1)/2);  // golden section angle
#declare py = -1;

#while(M>0)
  sphere {
    py*y, sr
    translate sqrt(1-py*py)*x
    rotate phi*y
    texture {
      pigment{color rgb 1}
      finish{ambient 0 diffuse 0.5 reflection{0.3, 0.7}}
    }
  }
  #declare py=-1+2*(M-1)/(N-1);
  #declare phi=phi+gsa;
  #declare M=M-1;
#end


Post a reply to this message

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