POV-Ray : Newsgroups : povray.newusers : area light vectors : Re: area light vectors Server Time
28 Jul 2024 12:26:09 EDT (-0400)
  Re: area light vectors  
From: Chris B
Date: 21 May 2009 14:37:03
Message: <4a159f4f@news.povray.org>
"stevenvh" <nomail@nomail> wrote in message 
news:web.4a1594d11e27adc7c0721a1d0@news.povray.org...
> Given my light source position (P1) and the center of my scene (P2), how 
> do I
> define the vectors of an area light?
> TIA
> Steven

If it's a circular area light and it meets the constraints listed in the 
help then you might be able to simply use the orient keyword.

Otherwise you can calculate two vectors that are perpendicular to (P2-P1). 
There are quite a few approaches that could do the job, so someone may well 
have a simpler method, but you can get a vector that's at right angles to 
P2-P1 and then get another that's at right angles to the two you've then got 
by using macros from the 'math.inc' include file that comes with POV-Ray:

#declare Vector1 = VPerp_To_Vector(P2-P1);
#declare Vector2 = VPerp_To_Plane(Vector1, P2-P1);

This assumes P1 isn't directly above or below P2.
That will give you unit length vectors that you'll need to multiply by 
whatever factors you want for the area light size.

If your area light is non-square you may want one of those vectors to be 
horizontal in which case you could use:

#declare IntermediaryHorizontalVector = VProject_Plane(P2-P1,y);
#declare Vector1 = VPerp_To_Plane(P2-P1,IntermediaryHorizontalVector);
#declare Vector2 = VPerp_To_Plane(Vector1, P2-P1);

(Look out for syntax errors and other typos 'cause I didn't run this through 
POV-Ray to check the code at all.)

Regards,
Chris B.


Post a reply to this message

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