POV-Ray : Newsgroups : povray.animations : Progress of shadows due to sunlight Server Time
2 May 2024 14:14:21 EDT (-0400)
  Progress of shadows due to sunlight (Message 1 to 7 of 7)  
From: JLH
Subject: Progress of shadows due to sunlight
Date: 12 Jun 2007 06:10:01
Message: <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


Post a reply to this message

From: Stephen
Subject: Re: Progress of shadows due to sunlight
Date: 12 Jun 2007 07:20:01
Message: <web.466e80eda2fa9d53c4e49fa40@news.povray.org>
"JLH" <phy### [at] physicsuoguelphca> wrote:
> 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


(light source) around the y axis for direction and the x or z axis for
altitude. Remember to create your sun at the origin and translate it to the
desired starting point before animating it.
You animate by using the clock variable.
Help file
2.3.8 Making Animations
2.3.8.1 The Clock Variable: Key To It All

There are other methods but to start with, this is the easiest IMO.

but if you want more detailed help with an example please post again.

BTW Welcome.



Stephen


Post a reply to this message

From: Chris B
Subject: Re: Progress of shadows due to sunlight
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

From: JLH
Subject: Re: Progress of shadows due to sunlight
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

From: Warp
Subject: Re: Progress of shadows due to sunlight
Date: 12 Jun 2007 18:54:07
Message: <466f240f@news.povray.org>
I don't really understand what *exactly* is the problem you are trying
to describe, but here's how you render an animation in povray:

  1) Use the 'clock' variable in your scene. This variable goes from 0.0
to 1.0 (independently of how many frames you render). You can use this
variable for whatever you want to move or setup during the duration of
the animation. For example, if you want some parameter to go from 0 to 24
(ie. hours), give "clock*24" as that parameter (since 'clock' goes from
0.0 to 1.0, then "clock*24" will go from 0.0 to 24.0).

  2) Use the command-line parameter +kff<n> where <n> is the number of
frames you want your animation to have. For example, if you want 20 frames,
use +kff20
  If you are using the windows version of povray, you can write command-line
parameters in the textfield at the top of the window (at the right of the
resolution selection drop-down menu).

  POV-Ray will render a series of images. You'll have to use a third-party
software to compose an animation from those images (eg. VirtualDub).

-- 
                                                          - Warp


Post a reply to this message

From: JLH
Subject: Re: Progress of shadows due to sunlight
Date: 13 Jun 2007 06:05:01
Message: <web.466fc0d9a2fa9d53fa1522790@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> I don't really understand what *exactly* is the problem you are trying
> to describe, but here's how you render an animation in povray:
>
>   1) Use the 'clock' variable in your scene. This variable goes from 0.0
> to 1.0 (independently of how many frames you render). You can use this
> variable for whatever you want to move or setup during the duration of
> the animation. For example, if you want some parameter to go from 0 to 24
> (ie. hours), give "clock*24" as that parameter (since 'clock' goes from
> 0.0 to 1.0, then "clock*24" will go from 0.0 to 24.0).
>
>   2) Use the command-line parameter +kff<n> where <n> is the number of
> frames you want your animation to have. For example, if you want 20 frames,
> use +kff20
>   If you are using the windows version of povray, you can write command-line
> parameters in the textfield at the top of the window (at the right of the
> resolution selection drop-down menu).
>
>   POV-Ray will render a series of images. You'll have to use a third-party
> software to compose an animation from those images (eg. VirtualDub).
>
> --
>                                                           - Warp

Thank you everyone for your help. I actually found the fault myself just
before reading the last post. It was the switching on of the animation with
the +kffn that I had missed. It works fine and I thank you all; I learned a
lot. Jim


Post a reply to this message

From: Chris B
Subject: Re: Progress of shadows due to sunlight
Date: 14 Jun 2007 08:55:30
Message: <46713ac2@news.povray.org>
Hi Jim,
> It works fine and I thank you all
>  Jim
>

Actually I just noticed a little error in the solution I posted.
The 6th parameter of the sunpos macro is actually the Meridian of your local 
timezone (+1 hour =  +15 deg) in degrees, and not the number of seconds as 
I'd assumed. Setting it to seconds makes the path slightly irregular, so 
it's probably easiest to set it to 0.

Regards,
Chris B.


Post a reply to this message

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