POV-Ray : Newsgroups : povray.animations : sunpos.inc and sunrise, sunset Server Time
5 Jul 2024 13:24:06 EDT (-0400)
  sunpos.inc and sunrise, sunset (Message 1 to 8 of 8)  
From: davidafisher
Subject: sunpos.inc and sunrise, sunset
Date: 2 Nov 2002 08:20:09
Message: <web.3dc3cfbec87668a667ebf1b60@news.povray.org>
I'm animating sunset and sunrise using SunPos as a light source set as

light_source {
              <0,0,0>      //0*x light's position starts at the origin
              color White  // light's color
              translate SunPos(Year, Month, Day, Hour, Minute, Lstm, LAT,
LONG);
}

and placing a sun in the sky by using skysphere as:

sky_sphere {
            pigment {gradient y
            color_map {[0.0 radians(0.03333) color Yellow   //for the sun
disk                                        color Yellow]
                       [radians(0.03333) (1-cos(radians(Al)))/2 color Blue
                                                                color Blue]
                       [(1-cos(radians(90-Al)))/2 color rgb<0.0,0.0,0.6156>]
                      }
            scale 2
            translate -1
           }
    //clouds
           pigment { etc etc.......

It works fine except as soon as the center of the light source hits the
horizon (given by Al, - Altitude)the whole light source and sun disk
disappear!

What do I need to do to continue to see the parts of the sun that remain
above the horizon until it should completely disappears (or appear for
sunrise)?

David


Post a reply to this message

From: ingo
Subject: Re: sunpos.inc and sunrise, sunset
Date: 2 Nov 2002 12:22:29
Message: <Xns92BABBC2C6AB8seed7@povray.org>
in news:web.3dc3cfbec87668a667ebf1b60@news.povray.org davidafisher wrote:

> It works fine except as soon as the center of the light source hits the
> horizon (given by Al, - Altitude)the whole light source and sun disk
> disappear!
> 

David,

Do you use a plane in your scene, if so once the sun is at the same hight 
the lightsource will dissapear. Replace your plane with a big translated 
sphere to simnulate planet curvature.

Also I tried your scene snippet, but, with watever date or time, all I get 
to see is blue sky everywhere. Could you post a more complete scene, with 
a date/time where it looks good and a dat/time where it goes wrong, in one 
of the scenefile groups.

Ingo


Post a reply to this message

From: Marc-Hendrik Bremer
Subject: Re: sunpos.inc and sunrise, sunset
Date: 2 Nov 2002 13:02:59
Message: <3dc41353@news.povray.org>
"davidafisher" <dav### [at] attbicom> schrieb im Newsbeitrag
news:web.3dc3cfbec87668a667ebf1b60@news.povray.org...

> It works fine except as soon as the center of the light source hits the
> horizon (given by Al, - Altitude)the whole light source and sun disk
> disappear!


I think you have to replace your light_source with a bunch of them. At the
moment, the light is emitted from one single point in space (at the center
of the disc), if this sinks under the horizon, your plane shadows the whole
scene. An area_light won't help you here, afaik. So split your light_source
in 9 perhaps scattered over your sun disk, each with 1/9 of the intensity of
the original one (White/9).

I might by wrong though, as I've never used sunpos.inc.

Regards,

Marc-Hendrik


Post a reply to this message

From: davidafisher
Subject: Re: sunpos.inc and sunrise, sunset
Date: 2 Nov 2002 15:55:08
Message: <web.3dc43ab9dccea13167ebf1b60@news.povray.org>
Neat ideas.

You are right I've been using a ground plane. The sphere approach would
probably work even with horizon features such as mountains etc. As there's
no plane there's no cutoff (except objects getting in the way of course).

The multiple light source sounds good but thats going to take some
computation due to the addition of horizon features.

I did think of using a disc placed as a reflector behind the light source?

but I'll give the sphere a go!

I let you know what happens!

David


Post a reply to this message

From: davidafisher
Subject: Re: sunpos.inc and sunrise, sunset
Date: 7 Nov 2002 14:55:05
Message: <web.3dcac283dccea13167ebf1b60@news.povray.org>
OK,
   this is driving me nuts.

I eliminated the plane, didnt help for, as soon as the light source
developed a negative y value with my camera on the positive side I lose it
anyway.

So I did this

#local discRad =
((r/100)*sin(radians(angsize)))/sin(radians((180-angsize)/2));    //disc
is nearer so angular size needs adjusting using Sine Law and distance r

#declare Sun =  disc {<0,0,r/600>  //adjust for 10^7 distance limitation
                      0,0,1>       // z as normal before rotation
                     discRad       // the compensated Sun size
                     pigment {Yellow}
                     finish {Luminous}
                     no_shadow
                     rotate <Al, Az, 0>  // need rotation to keep disc
facing us
              }
Sun

// now distribute a light every 10 degrees around the outer edge of the disc
called Sun

#local distrib_count = 0;
#while (distrib_count <36)
  light_source { <0,0,r/600>
                 color White*0.027778     // 1/36th intensity
                 rotate <-Al, Az, 0>
                 translate y*discRad      // move it to the edge of Sun
                 Rotate_Around_Trans(10*distrib_count, Sun)
                }
        #local distrib_count = distrib_count+1;
#end


But any way I try I can't get the vector values of the object defined as
Sun!


What next??


Post a reply to this message

From: Marc-Hendrik Bremer
Subject: Re: sunpos.inc and sunrise, sunset
Date: 7 Nov 2002 18:23:14
Message: <3dcaf5e2@news.povray.org>
"davidafisher" <dav### [at] attbicom> schrieb im Newsbeitrag
news:web.3dcac283dccea13167ebf1b60@news.povray.org...

> #local distrib_count = 0;
> #while (distrib_count <36)
>   light_source { <0,0,r/600>
>                  color White*0.027778     // 1/36th intensity
>                  rotate <-Al, Az, 0>
>                  translate y*discRad      // move it to the edge of Sun
>                  Rotate_Around_Trans(10*distrib_count, Sun)
>                 }
>         #local distrib_count = distrib_count+1;
> #end
>

As far as I can say, you just have to change the sequence of your rotations
and translations. translate the light_source to the edge of the disc, rotate
it around it's center (a simple rotate should do taht as the sun is still at
the origin) and rotate it at the end to the position you want the sun
(rotate <-Al, Az, 0>). That should do the job.

Hth,

Marc-Hendrik


Post a reply to this message

From: davidafisher
Subject: Re: sunpos.inc and sunrise, sunset
Date: 8 Nov 2002 11:35:05
Message: <web.3dcbe728dccea13167ebf1b60@news.povray.org>
davidafisher wrote:
>OK,
>   this is driving me nuts.
>
>I eliminated the plane, didnt help for, as soon as the light source
>developed a negative y value with my camera on the positive side I lose it
>anyway.
>
>So I did this
>
>#local discRad =
>((r/100)*sin(radians(angsize)))/sin(radians((180-angsize)/2));    //disc
>is nearer so angular size needs adjusting using Sine Law and distance r
>
>#declare Sun =  disc {<0,0,r/600>  //adjust for 10^7 distance limitation
>                      0,0,1>       // z as normal before rotation
>                     discRad       // the compensated Sun size
>                     pigment {Yellow}
>                     finish {Luminous}
>                     no_shadow
>                     rotate <Al, Az, 0>  // need rotation to keep disc
>facing us
>              }
>Sun
>
>// now distribute a light every 10 degrees around the outer edge of the disc
>called Sun
>
>#local distrib_count = 0;
>#while (distrib_count <36)
>  light_source { <0,0,r/600>
>                 color White*0.027778     // 1/36th intensity
>                 rotate <-Al, Az, 0>
>                 translate y*discRad      // move it to the edge of Sun
>                 Rotate_Around_Trans(10*distrib_count, Sun)
>                }
>        #local distrib_count = distrib_count+1;
>#end
>
>
>But any way I try I can't get the vector values of the object defined as
>Sun!
>
>
>What next??
>

Using the disc and light approach addresses my original problem so maybe
this should be in another section other than animation, but my problem
now seems to be more of referencing the vectors of a declared object - in
this case the Sun.   The macro Rotate_Around_Trans dies with a "this is not
a numeric expression - object identifier found instead" and if I try other
combinations of macros or direct reference to say Sun.x I get the same
error. I thought it might be because its a disc but changing it to a sphere
has the same result.

So what am I missing about reference the vectors of a declared object?


Post a reply to this message

From: davidafisher
Subject: Re: sunpos.inc and sunrise, sunset
Date: 8 Nov 2002 14:50:02
Message: <web.3dcc1449dccea13167ebf1b60@news.povray.org>
I think I found my own answer.

Declared objects don't have center vectors but bounding boxes. to find the
center of the Sun object in the above code I've applied the following

#declare SunMin = min_extent ( Sun );
#declare SunMax = max_extent ( Sun );
#declare SunVector =
<(SunMin.x+SunMax.x)/2,(SunMin.y+SunMax.y)/2,(SunMin.z+SunMax.z)/2>;

Now to sweat the next problem!


Post a reply to this message

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