POV-Ray : Newsgroups : povray.newusers : hourly cast sun shadows : Re: hourly cast sun shadows Server Time
17 Apr 2024 05:36:22 EDT (-0400)
  Re: hourly cast sun shadows  
From: Bald Eagle
Date: 27 Oct 2017 20:10:00
Message: <web.59f3c9ed7c823ed45cafe28e0@news.povray.org>
"MustardMan" <nomail@nomail> wrote:

> 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?

Not that I'm aware of, but consider:
if you define a vector - a "ray" from your point light source to any point on
the panel, then you can likely perform some sort of intersection test on that
line and an object.
"Easy" if you have geometric/mathematical primitives as obstructions, but likely
much more difficult if you have some complex geometry.

The other thing you could do is run a 3-stage simulation.
1. For the first simulation, set up your scene so that the camera is
normal/perpendicular to your panel, the camera type is orthographic, and your
panel fills an x or y dimension of the render.
Run your animation so that you get a set of frames showing the panel over the
course of changing light conditions.
This will give you a set of images.

2. Run a second "animation" - where no actual render is needed - so you can set
the render size to something tiny - and the point is to scan the frames from the
first animation with eval_pigment() across the x dimensions and down the y
dimensions of the panel.  Use an image_map of the automatically named frame on a
For this, you don't need a light, a camera, or any objects in the scene, because
the eval_pigment works on the "definition" - the unrendered pigment on the box -
but that pixel's pigment is now a result of the full raytracer lighting
calculations done in the first animation.

#declare Image_File = concat("Filename",str(frame_number, -5, 0), ".png")


Write all of that eval_pigment data to a file, or just the results of your
calculations for that frame.

3. Do your regular animation, and read the data from the file in step 2 for
whatever purposes you need during the animation.

Those are the broad strokes - I think you can follow that and work out most of
the small details.

Post a reply to this message

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