|
![](/i/fill.gif) |
Geoff Wedig wrote:
>
> Right, but what's the axis of rotation? if the area light is non uniform,
> this makes a difference. Ie, if we have an area light that's twice as wide
> as tall, and a point that's perpendicular to its normal, do we get a small
> square or a big square, or something in between? When the area light is
> uniform, it's obvious what it does, when the axes are of different lengths,
> it isn't clear what the shape of the light appears to be when looked at from
> a particular object.
>
> The obvious axes of rotate are the axes of the area light itself, but again,
> how much of each is used, and which is first (if, indeed, those are the axes
> used, which is non-obvious)? Because the shape of the light is affected
> greatly by the order and magnitude of these rotations.
The answer is in the code (lighting.c file), there is even clear comments.
let a1 and a2 the original axis of the area light
let r be the vector of the ray
let n1 and n2 be the reoriented axis of the area light, and t a temporary
vector.
the formula is like (all operands are vectors)
t = a1 x r
n1 = t x r
t = a2 x r
n2 = t x r
(the code is more sophisticated, because it has to deal with various vector
lengths,
whereas the above formula are fine only with unit-vectors)
I wonder if there is not a bug in the formula when r is k.a1 or k.a2 (but
maybe this is already tested, and the correction is obviously to replace
the null vector with the cross product of r and the other new axis)
Alas, I do not have the code at hand right now...
Post a reply to this message
|
![](/i/fill.gif) |