POV-Ray : Newsgroups : povray.general : Light Attenuation : Re: Light Attenuation Server Time
25 Apr 2024 20:16:58 EDT (-0400)
  Re: Light Attenuation  
From: clipka
Date: 12 Mar 2011 12:19:33
Message: <4d7bab25$1@news.povray.org>
Am 12.03.2011 15:37, schrieb Trevor G Quayle:

>> Maybe things become a bit clearer by writing the attenuation function
>> differently:
>>
>>     a =     2 / ( 1             + (d/FD)^FP )
>>       =     2 / ( FD^FP / FD^FP + d^FP  / FD^FP )
>>       =     2 / (       ( FD^FP + d^FP) / FD^FP )
>>       = FD^FP /         ( FD^FP + d^FP )
>>       =     c /             ( c + d^FP )
>>
>>     a ~ 1 / ( c + d^FP )
>>
>> If you'd choose c=0 and FD=2, you'd theoretically get the attenuation
>> law you're asking for - except that you'd need an infinitely bright
>> light source to compensate for the proportionality factor. So choose a
>> very, very small FD (giving a very, very small c in the above formula),
>> multiply the light source intensity by FD^FP (presuming you previously
>> used FD=1), and you'll be fine. Even theater projectors aren't perfect
>> in simulating a point light source, so it's also realistic.
>
> While your math is sound, a=c/(c+d^FP) is only equal to 1/(c+d^FP) for c=1 and
> 1/(c+d^FP) is only inverse square for c=0, so the equations can't be taken as
> equivalent, and they aren't as I have already demonstrated.  A simple test of
> this is that if a=1 at x=1, then it should follow that a=1/4 at x=2, but it
> isn't, a=0.4 which is 60% higher than it should be.

Note that the last line is "a ~ ...", not "a = ...". With the 
attenuation being a factor applied to the light brightness, it suffices 
to have a formula that is proportional to the desired one, and adjust 
the light brightness to compensate for the proportionality factor.

> I understand the with light sources in POV being points and this turns the
> intensity to infinite, however there would be ways to overcome it while
> generally preserving the function:
>
> 1. minimize the function to 1 (for this, a=1 for any x<FD)
> in this case you are simulating the light surface to be at x=FD (i.e. a sphere
> with r=FD), and essentially anything below (inside) gets a constant value
>
> or
> 2. offset the function by FD so that a=1 starts at x=0
> this is similar to 1, you are treating the light surface as a sphere of r=FD,
> but you are offsetting it to the point light location (shrinking it to a point,
> while just offsetting the function.

Both solutions are mathematically incorrect, both for point lights and 
for light sources of non-zero size. (Not to mention that they wouldn't 
be backward compatible with existing scenes.)

While the current formula requires some tweaking to the light brightness 
in case you change the FD, it is mathematically sound, and should be 
powerful enough to give you what you want, given proper settings.

(I'd also like to point out once again that realistic results can only 
be achieved with an assumed_gamma setting of 1.0. Did you check that 
this is what you're using?)


Post a reply to this message

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