 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Hi there,
Does anyone have suggestions for generating a night sky with stars? A big
spehere with random holes punched through it? :) I obviously can't use
light to illuminate a sky_sphere.
Yann
--
--------------------------------------------------------------------
Yann Ramin atr### [at] atrustrivalie eu org
Atrus Trivalie Productions www.redshift.com/~yramin
Monterey High IT www.montereyhigh.com
AIM oddatrus
Marina, CA
IRM Developer Network Toaster Developer
SNTS Developer KLevel Developer
--------------------------------------------------------------------
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Yann Ramin" <atr### [at] atrustrivalie eu org> wrote in message
news:39d2d4cd@news.povray.org...
|
| Does anyone have suggestions for generating a night sky with stars? A big
| spehere with random holes punched through it? :) I obviously can't use
| light to illuminate a sky_sphere.
Easiest thing to do is use the star texture on a sky_sphere, it's in the
texture.inc file which comes with POV. In MegaPov there's a post process
kind too.
Second easiest would be to use the galaxy.inc from Chris Colefax, or one of
the others people have done already. There is one which mimics the true
stellar sky using Hubble data I believe.
I can't go looking much now for specific ones but at:
http://www.btinternet.com/~consty/render/render_f.htm
go to the Utilities then POV files and there'll be both a link to Chris
Colefax's site and a 3D Starfield file.
Bob
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
and turn up up the ambient in its the finish{} statement to make the stars
light up (with radiosity turned on these can practically become light
sources).
--
Dan D.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Bob Hughes wrote:
>
> "Yann Ramin" <atr### [at] atrustrivalie eu org> wrote in message
> news:39d2d4cd@news.povray.org...
> |
> | Does anyone have suggestions for generating a night sky with stars? A big
> | spehere with random holes punched through it? :) I obviously can't use
> | light to illuminate a sky_sphere.
>
> Easiest thing to do is use the star texture on a sky_sphere, it's in the
> texture.inc file which comes with POV. In MegaPov there's a post process
> kind too.
Post processing is better, because you don't have problems with
antialiasing, which usualy eats all stars ;-).
> Second easiest would be to use the galaxy.inc from Chris Colefax, or one of
> the others people have done already. There is one which mimics the true
> stellar sky using Hubble data I believe.
> I can't go looking much now for specific ones but at:
> http://www.btinternet.com/~consty/render/render_f.htm
> go to the Utilities then POV files and there'll be both a link to Chris
> Colefax's site and a 3D Starfield file.
>
> Bob
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
ddombrow wrote:
>
> and turn up up the ambient in its the finish{} statement to make the stars
> light up (with radiosity turned on these can practically become light
> sources).
I think, that they are too small for it...
Disnel
>
> --
> Dan D.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Yann Ramin <atr### [at] atrustrivalie eu org> wrote in message
news:39d2d4cd@news.povray.org...
> Hi there,
>
> Does anyone have suggestions for generating a night sky with stars? A big
> spehere with random holes punched through it? :) I obviously can't use
> light to illuminate a sky_sphere.
>
I generally use some version of the following
#declare StarNo=0;
#declare rndPos=seed(8932)
#while (StarNo<1000) // change value for more or less stars
sphere {
<1000,0,0>,1 // change numbers according to scale of scene
texture {
pigment {rgb 1}
finish {ambient 0.9}
}
rotate <360*rand(rndPos),360*rand(rndPos),360*rand(rndPos)>
}
#declare StarNo=StarNo+1
#end
Gail
********************************************************************
* gsh### [at] monotix co za * System.dat not found. *
* http://www.rucus.ru.ac.za/~gail/ * Reformat hard drive Y)es O)k *
********************************************************************
* If at first you don't succeed, call it version 1.0 *
********************************************************************
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Gail Shaw <gsh### [at] monotix co za> wrote:
: sphere {
: <1000,0,0>,1 // change numbers according to scale of scene
: rotate <360*rand(rndPos),360*rand(rndPos),360*rand(rndPos)>
This has two main problems.
Firstly, the sphere is located in the x-axis (at <1000,0,0>), so the
first rotation (which is around the x-axis) will have no effect.
Secondly, rotating an evenly random angle around the y-axis and then
an evenly random angle around the z-axis has an undesired effect: You
will have more stars near the y-axis (ie. around <0,1000,0>) than near
the x-z plane.
That is, the stars are not evenly scattered around the sky but there are
more stars directly "up" than near the "horizon".
If you want an even distribution of stars you have to use a bit more
complicated algorithm. For example:
1) Calculate a random point inside a sphere (eg. a unit sphere). The
random distribution must be even.
2) Translate this point in the direction origin-point (ie. multiply it by
a value) so that its distance from the origin will be the desired (eg. 1000).
For example something like this:
#declare Stars = 1000;
#declare Distance = 1000;
#declare StarRadius = 1;
#declare Seed=seed(0);
#local Ind=0;
#while(Ind<Stars)
#local Location = <-1+rand(Seed)*2, -1+rand(Seed)*2, -1+rand(Seed)*2>;
#while(vlength(Location) > 1)
#local Location = <-1+rand(Seed)*2, -1+rand(Seed)*2, -1+rand(Seed)*2>;
#end
#local Location = Distance*Location/vlength(Location);
sphere { Location, StarRadius pigment { rgb 1 } finish { ambient 1 } }
#local Ind=Ind+1;
#end
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Hi Warp!
Just curios: Why the inner loop? I don't see a reason to keep the length of
Location below 1.
vlength(Location/vlenth(Location)) is always 1 isn't it?
Or is it already too late at night?
KK
Warp <war### [at] tag povray org> wrote:
> For example something like this:
>
> #declare Stars = 1000;
> #declare Distance = 1000;
> #declare StarRadius = 1;
> #declare Seed=seed(0);
>
> #local Ind=0;
> #while(Ind<Stars)
> #local Location = <-1+rand(Seed)*2, -1+rand(Seed)*2, -1+rand(Seed)*2>;
> #while(vlength(Location) > 1)
> #local Location = <-1+rand(Seed)*2, -1+rand(Seed)*2, -1+rand(Seed)*2>;
> #end
> #local Location = Distance*Location/vlength(Location);
> sphere { Location, StarRadius pigment { rgb 1 } finish { ambient 1 } }
> #local Ind=Ind+1;
> #end
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
KalleK wrote:
> Just curios: Why the inner loop? I don't see a reason to keep the length of
> Location below 1.
> vlength(Location/vlenth(Location)) is always 1 isn't it?
> Or is it already too late at night?
Warp's code evenly distributes points within a cube at the origin. In order to
make an even spherical distribution, only the subset of these points within a
sphere that fits inside the cube is taken. The point is then moved to a fixed
distance from the origin.
--
David Fontaine <dav### [at] faricy net> ICQ 55354965
My raytracing gallery: http://davidf.faricy.net/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Sorry: too late at night...
Having turned of the computer yesterday, i realized my fault.
Thanks!
KK
> Warp's code evenly distributes points within a cube at the origin. In
order to
> make an even spherical distribution, only the subset of these points
within a
> sphere that fits inside the cube is taken. The point is then moved to a
fixed
> distance from the origin.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Warp <war### [at] tag povray org> wrote in message news:39d35005@news.povray.org...
> Secondly, rotating an evenly random angle around the y-axis and then
> an evenly random angle around the z-axis has an undesired effect: You
> will have more stars near the y-axis (ie. around <0,1000,0>) than near
> the x-z plane.
> That is, the stars are not evenly scattered around the sky but there are
> more stars directly "up" than near the "horizon".
I noticed that but thought it was just a coincidence
> If you want an even distribution of stars you have to use a bit more
> complicated algorithm. For example:
> 1) Calculate a random point inside a sphere (eg. a unit sphere). The
> random distribution must be even.
> 2) Translate this point in the direction origin-point (ie. multiply it
by
> a value) so that its distance from the origin will be the desired (eg.
1000).
>
> For example something like this:
<snip code>
Thanks, I'll take a look at that
Gail
--
********************************************************************
* gsh### [at] monotix co za * System.dat not found. *
* http://www.rucus.ru.ac.za/~gail/ * Reformat hard drive Y)es O)k *
********************************************************************
* If at first you don't succeed, call it version 1.0 *
********************************************************************
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Gail Shaw <gsh### [at] monotix co za> wrote in message
news:39d44c11@news.povray.org...
>
> Warp <war### [at] tag povray org> wrote in message
news:39d35005@news.povray.org...
>
> <snip code>
>
> Thanks, I'll take a look at that
>
Make that a double thanks. You've also solved the problem I was having with
the
lightning macro I'm fiddling with.
Gail
--
********************************************************************
* gsh### [at] monotix co za * System.dat not found. *
* http://www.rucus.ru.ac.za/~gail/ * Reformat hard drive Y)es O)k *
********************************************************************
* If at first you don't succeed, call it version 1.0 *
********************************************************************
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
If I don't take only the points inside the sphere I would create more
points in the "corners" than other places. It would mean that there are
more stars in the direction of the eight corners of the cube.
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Warp <war### [at] tag povray org> wrote:
: #while(vlength(Location) > 1)
That should be:
#while(vlength(Location) > 1 | vlength(Location) = 0)
Else there is the danger of a division by 0 (very improbable due to the
nature of the random numbers, but possible).
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Warp <war### [at] tag povray org> wrote:
> If I don't take only the points inside the sphere I would create more
> points in the "corners" than other places. It would mean that there are
> more stars in the direction of the eight corners of the cube.
So, instead of generating 3 numbers, generate 2, latitude and longitude.
Ie:
#declare c1 = 180 * rand(s1) - 90;
#declare c2 = 360 * rand(s1);
translate <0,0,1000> // Assuming object originally at origin.
rotate <0, c2, c1> // This means y is up direction, but it is really
// irrelevant which rotation is first and which
// of the axes as used as long as the first axis is
// not the direction of translation.
You might want to translate a randomly chosen distance, and/or size the
object as well, but that's pretty easy.
This code seems a *lot* shorter (and therefore faster) than the other code
I've seen. And you only need one loop and no checks for being within a
certain space.
Geoff
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Geoff Wedig <wed### [at] darwin epbi cwru edu> wrote:
: So, instead of generating 3 numbers, generate 2, latitude and longitude.
: Ie:
: #declare c1 = 180 * rand(s1) - 90;
: #declare c2 = 360 * rand(s1);
: translate <0,0,1000> // Assuming object originally at origin.
: rotate <0, c2, c1> // This means y is up direction, but it is really
: // irrelevant which rotation is first and which
: // of the axes as used as long as the first axis is
: // not the direction of translation.
This is exactly the mistake made in the original code.
That doesn't distribute the points evenly. There will be more spheres
near the z-axis than elsewhere.
You can test that if you like. Create LOTS of spheres with that algorithm.
You'll notice how they will concentrate near the z-axis.
The idea behind my algorithm is that the spheres are truely distributed
evenly around the sphere.
--
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Warp" <war### [at] tag povray org> wrote in message
news:39d4b63c@news.povray.org...
> This is exactly the mistake made in the original code.
> That doesn't distribute the points evenly. There will be more spheres
> near the z-axis than elsewhere.
... because 10 spheres placed at <0,10, 0> and rotated randomly around z =
10 spheres in random x, y locations, but 10 spheres placed at <0,0,10> and
rotated randomly around z = 10 spheres at <0,0,10>? (Tom runs off to check
some code that's been giving him unexpected results).
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Warp wrote:
> This is exactly the mistake made in the original code.
> That doesn't distribute the points evenly. There will be more spheres
> near the z-axis than elsewhere.
> You can test that if you like. Create LOTS of spheres with that algorithm.
> You'll notice how they will concentrate near the z-axis.
Will the points be evenly distributed if the latitudes are redistributed using
the function 1-cos(latitude*pi/2), assuming the latitude ranges from -1 to 1?
--
David Fontaine <dav### [at] faricy net> ICQ 55354965
My raytracing gallery: http://davidf.faricy.net/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Yann Ramin <atr### [at] atrustrivalie eu org> wrote:
> Does anyone have suggestions for generating a night sky with stars? A big
> spehere with random holes punched through it? :) I obviously can't use
> light to illuminate a sky_sphere.
As Bob has mentioned, I have a include file that will do this for you. It
is particuarly designed to create the maximum number of stars with the
minimum of memory usage and parsing time. Also, unlike other methods posted
it supports various types of stars, and the stars are pre-antialiased, so
they do not slow down rendering much, if at all, when you turn anti-aliasing
on. You can download the include file as part of the Galaxy Include package
at:
http://www.geocities.com/ccolefax
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> Secondly, rotating an evenly random angle around the y-axis and then
> an evenly random angle around the z-axis has an undesired effect: You
> will have more stars near the y-axis (ie. around <0,1000,0>) than near
> the x-z plane.
> That is, the stars are not evenly scattered around the sky but there are
> more stars directly "up" than near the "horizon".
but what about the milky way? there should be more stars along some
line; the galaxy plane.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |