POV-Ray : Newsgroups : povray.newusers : hourly cast sun shadows : Re: hourly cast sun shadows Server Time
17 Apr 2024 05:07:39 EDT (-0400)
  Re: hourly cast sun shadows  
From: Alain
Date: 27 Oct 2017 20:45:27
Message: <59f3d327$1@news.povray.org>
Le 17-10-27 à 17:41, MustardMan a écrit :
> clipka <ano### [at] anonymousorg> wrote:
>> Am 11.10.2017 um 23:52 schrieb JimJulian:
>>>     I need to plot the shadows cast by objects surrounding my back yard. I have a
>>> solar power station there and want to determine the best location for the array.
>>> Perhaps I need to make the array mobile for best results. I don't know. I want
>>> to write a program that will achieve that.
>> Maybe the `sunpos.inc` include file that ships with POV-Ray already does
>> the job.
> Hi, I've used 'sunpos' to great effect, and in fact I'm currently doing a
> simulation of some solar panels on a roof with the horizon as a "wall" about a
> kilometre away. The simulation produces a very good looking frame sequence (and
> I can make an avi from those), and I can also generate a file with the power
> percentage a panel will receive (in 5 minute increments) according to the angle
> of the sun and the angle of the panel. [dot product of the angle vectors].
> However, I would like to automatically determine if a panel (or a point on the
> panel) is "in the shade". I've not seen anywhere a hint for determining if a
> point can "see" the light source, or if it is in shadow. Is there a function for
> doing that?
> At present I have to look at the frame sequence and manually decide where I have
> to start/stop integrating the power figures that pop out of my file. It would be
> great if I could get those numbers automatically, especially for multiple days
> throughout the year. It is so tiring to do it manually, and repeat it if I
> change the panel positions.
> Thanks!

You may want to use the trace() function from your interest point toward 
the light against an union of every objects in your scene.
Something like:
#declare Direction = Source_Point - Light_Pos;
#declare Norm=<1,1,1>;
#declare Intersect = trace(Source_Point, Direction, Norm);

"Norm" will contain the normal at the point of intersection, or Null if 
it don't hit the target object.
"Intersect" will contain the location of the point of intersection with 
the first surface encountered.

Where «Source_point» is a previously defined point just above your sun 
If the length of Norm = 0, then, the path is unobstructed. The test ray 
passed right through the light_source and ended against the background. 
Just be sure that you don't use some very large object as your background.

If not, then, there is something between you and the light = you are in 
a shadowed area.

Post a reply to this message

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