|
![](/i/fill.gif) |
"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
|
![](/i/fill.gif) |