POV-Ray : Newsgroups : povray.animations : Progress of shadows due to sunlight : Re: Progress of shadows due to sunlight Server Time
17 May 2024 03:27:05 EDT (-0400)
  Re: Progress of shadows due to sunlight  
From: JLH
Date: 12 Jun 2007 17:55:01
Message: <web.466f15efa2fa9d53c56e4b040@news.povray.org>
"Chris B" <c_b### [at] btconnectcomnospam> wrote:
> "JLH" <phy### [at] physicsuoguelphca> wrote in message
> news:web.466e70072f7abf22f6f5439e0@news.povray.org...
> >I am new to Povray and have been making progress with architectural models.
> > I would now like to animate the motion of the shadows of the buildings as
> > the day progresses. I thought it might be achieved by somehow advancing
> > the
> > time in the "sunpos" command but I can't for the life of me figure out how
> > to do it. Could anyone out there help this 75 year old student with this
> > problem?
> > JLH
> >
>
> Hi J,
>
> There are quite a few ways you could do it. One way is to use the clock
> variable, so that, as it passes from 0 to 1 through your animation cycle,
> you generate the time of day. The following example multiplies the clock
> value by the number of seconds since midnight, then splits that out into
> hours, minutes and seconds to pass to the sunpos macro. I've used the
> MyClock variable so that you can set it by hand and see what it's doing with
> 0.4 representing 9:36am. I've added some #debug directives so that you can
> look in the message stream and see the values that are being used and the
> sun position being generated as you play around with the figures. When you
> want to generate an animation simply replace the manual setting with the
> commented line and you should see the progression through the day.
>
> Another alternative would be to use the frame_number to access arrays of
> times that you could specify by hand.
>
> Hope this helps,
>
> Regards,
> Chris B.
>
>
> #include "sunpos.inc"
>
> camera {location <0, 0.8,-2> look_at  <0,0,0>}
> //#declare MyClock = clock;
> #declare MyClock = 0.4;
>
> #declare Seconds = MyClock*24*60*60;
> #declare HH = div(Seconds,60*60);
> #declare MM = div(Seconds,60)-HH*60;
> #declare SS = Seconds-MM*60-HH*60*60;
>
>
> #debug concat("HH: ",str(HH,3,3),"n")
> #debug concat("MM: ",str(MM,3,3),"n")
> #debug concat("SS: ",str(SS,3,3),"n")
>
> light_source {
>    //Greenwich, noon on the longest day of 2000
>    SunPos(2000, 6, 21, HH, MM, SS, 51.4667, 0.00)
>    rgb 1
> }
>
> #debug concat("Sun Position: ",vstr(3,SunPos(2000, 6, 21, HH, MM, SS,
> 51.4667, 0.00),",",3,3),"n")
>
>
> plane {y,0 pigment {color rgb 1}}
> cylinder {<0,0,0>,<0,1,0>,0.1 pigment {color rgb 1}}
> cylinder {<1,0,0>,<1,1,0>,0.1 pigment {color rgb 1}}

Chris: I am very grateful for the trouble you took to help me but I am going
to appeal to your good nature for further help because I cant get it to
work! With the statement
#declare MyClock = 0.4;
it certainly works as expected with a picture and shadows. However when I de
select it and select the statement above I get a black screen. I have tried
a myriad of things to no avail. I guess my problem is that I do not
understand the "clock" function. It seems underdefined to me. What
determines its rate? Was my animation running but it was night and I would
have to wait 12 hours for the animation to provide me with light in real
time? I can't believe it! Certainly it was showing night because I was
smart enough to add 12 to the HH and behold!! light, but still no
animation. Perhaps I'm too old to grasp whatever subtelty is holding me
back from solving the problem. Any help that doesn't tax your own valuable
time would be appreciated. Jim


Post a reply to this message

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