POV-Ray : Newsgroups : povray.general : Star night sky Server Time
9 Aug 2024 03:25:35 EDT (-0400)
  Star night sky (Message 11 to 20 of 20)  
<<< Previous 10 Messages Goto Initial 10 Messages
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

<<< Previous 10 Messages Goto Initial 10 Messages

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