POV-Ray : Newsgroups : povray.animations : Progress of shadows due to sunlight : Re: Progress of shadows due to sunlight Server Time
17 May 2024 08:12:34 EDT (-0400)
  Re: Progress of shadows due to sunlight  
From: Chris B
Date: 12 Jun 2007 07:20:26
Message: <466e817a$1@news.povray.org>
"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}}


Post a reply to this message

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