POV-Ray : Newsgroups : povray.newusers : area light vectors : Re: area light vectors Server Time
28 Jul 2024 12:37:02 EDT (-0400)
  Re: area light vectors  
From: clipka
Date: 21 May 2009 15:40:01
Message: <web.4a15ada7f95db164e1d5d3040@news.povray.org>
"stevenvh" <nomail@nomail> wrote:
> "stevenvh" <nomail@nomail> wrote:
> > Given my light source position (P1) and the center of my scene (P2), how do I
> > define the vectors of an area light?
>
> .... er, that is, if I want the area light perpendicular with P2-P1.
>
> Steven

Assuming that you don't intend to use the "orient" keyword, you can compute the
X and Y of the are light source as follows:

(1) choose an "Up" vector you want your area light Y to be "as close as
possible" to, e.g.

  #declare Up = <0,1,0>;

(Make sure your "Up" vector is not parallel to P2-P1, or the following steps
will give you mashed potatoes.)

(2) choose your area light's "X" vector to be perpendicular to the direction
P2-P1 and the Up vector:

  #declare AreaLightX = vnormalize(vcross(P2-P1, Up)) * AreaLightSize;

(3) choose your area light's "Y" vector to be perpendicular to the direction
P2-P1 and the X vector:

  #declare AreaLightY = vnormalize(vcross(P2-P1, X)) * AreaLightSize;


Post a reply to this message

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