POV-Ray : Newsgroups : povray.general : Star night sky Server Time
16 Oct 2026 06:31:25 EDT (-0400)
  Star night sky (Message 1 to 20 of 20)  
From: Yann Ramin
Subject: Star night sky
Date: 28 Sep 2000 01:19:09
Message: <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.

Yann
-- 

--------------------------------------------------------------------
Yann Ramin                      atr### [at] atrustrivalieeuorg
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

From: Bob Hughes
Subject: Re: Star night sky
Date: 28 Sep 2000 01:35:39
Message: <39d2d8ab@news.povray.org>
"Yann Ramin" <atr### [at] atrustrivalieeuorg> 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

From: ddombrow
Subject: Re: Star night sky
Date: 28 Sep 2000 01:42:55
Message: <39d2da5f$1@news.povray.org>
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

From: disnel
Subject: Re: Star night sky
Date: 28 Sep 2000 08:24:06
Message: <39D3394B.6C243333@hlavacek-partner.cz>
Bob Hughes wrote:
> 
> "Yann Ramin" <atr### [at] atrustrivalieeuorg> 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

From: disnel
Subject: Re: Star night sky
Date: 28 Sep 2000 08:24:45
Message: <39D33972.B13A4F09@hlavacek-partner.cz>
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

From: Gail Shaw
Subject: Re: Star night sky
Date: 28 Sep 2000 08:36:50
Message: <39d33b62@news.povray.org>
Yann Ramin <atr### [at] atrustrivalieeuorg> 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] monotixcoza              * 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

From: Warp
Subject: Re: Star night sky
Date: 28 Sep 2000 10:04:53
Message: <39d35005@news.povray.org>
Gail Shaw <gsh### [at] monotixcoza> 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

From: KalleK
Subject: Re: Star night sky
Date: 28 Sep 2000 16:19:20
Message: <39d3a7c8@news.povray.org>
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] tagpovrayorg> 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

From: David Fontaine
Subject: Re: Star night sky
Date: 28 Sep 2000 21:02:53
Message: <39D3E7FA.15D62A5D@faricy.net>
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] faricynet>  ICQ 55354965
My raytracing gallery:  http://davidf.faricy.net/


Post a reply to this message

From: KalleK
Subject: Re: Star night sky
Date: 29 Sep 2000 02:33:50
Message: <39d437ce$1@news.povray.org>
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

From: Gail Shaw
Subject: Re: Star night sky
Date: 29 Sep 2000 04:00:17
Message: <39d44c11@news.povray.org>
Warp <war### [at] tagpovrayorg> 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] monotixcoza              * 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

From: Gail Shaw
Subject: Re: Star night sky
Date: 29 Sep 2000 07:12:48
Message: <39d47930@news.povray.org>
Gail Shaw <gsh### [at] monotixcoza> wrote in message
news:39d44c11@news.povray.org...
>
> Warp <war### [at] tagpovrayorg> 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] monotixcoza              * 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

From: Warp
Subject: Re: Star night sky
Date: 29 Sep 2000 07:21:22
Message: <39d47b31@news.povray.org>
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

From: Warp
Subject: Re: Star night sky
Date: 29 Sep 2000 07:26:02
Message: <39d47c4a@news.povray.org>
Warp <war### [at] tagpovrayorg> 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

From: Geoff Wedig
Subject: Re: Star night sky
Date: 29 Sep 2000 08:46:04
Message: <39d48f0c@news.povray.org>
Warp <war### [at] tagpovrayorg> 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

From: Warp
Subject: Re: Star night sky
Date: 29 Sep 2000 11:33:16
Message: <39d4b63c@news.povray.org>
Geoff Wedig <wed### [at] darwinepbicwruedu> 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

From: Tom Melly
Subject: Re: Star night sky
Date: 29 Sep 2000 11:54:26
Message: <39d4bb32$1@news.povray.org>
"Warp" <war### [at] tagpovrayorg> 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

From: David Fontaine
Subject: Re: Star night sky
Date: 29 Sep 2000 16:58:47
Message: <39D50041.8C46370A@faricy.net>
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] faricynet>  ICQ 55354965
My raytracing gallery:  http://davidf.faricy.net/


Post a reply to this message

From: Chris Colefax
Subject: Re: Star night sky
Date: 29 Sep 2000 21:11:33
Message: <39d53dc5@news.povray.org>
Yann Ramin <atr### [at] atrustrivalieeuorg> 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

From: ryan constantine
Subject: Re: Star night sky
Date: 30 Sep 2000 13:39:23
Message: <39D62558.A780D00F@yahoo.com>
>   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

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