POV-Ray : Newsgroups : povray.general : Light Attenuation : Re: Light Attenuation Server Time
7 May 2024 23:44:03 EDT (-0400)
  Re: Light Attenuation  
From: clipka
Date: 13 Mar 2011 05:34:35
Message: <4d7c8fab$1@news.povray.org>
Am 12.03.2011 20:25, schrieb Trevor G Quayle:

>> 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 know it was an approximation, but the point being that there is a difference
> still, and it can be quite large if you know what you are looking at.  It is
> difficult to get them to be equal or or close because they are different curves.
>   Actually the closest I can get the two curves to match  is with power values of
> 2.5-3 not 2

As I already mentioned, the key is not the fade_power, but the 
fade_distance. Sufficiently far away from the light source - relative to 
fade_distance (or, in other words, with sufficiently small fade_distance 
relative to the scene dimensions) - the formula gets arbitrarily close 
to 1/x^2.

>>
>>>
>>> 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.
>
> I know they aren't correct, but the true 1/x^2 function is though, but it breaks
> down at the low values because these aren't technically possible.  We have to
> note what we are calculating, it isn't the total light brightness, it is the
> birghtness per unit area and mathematically for a point, the area would be 0
> giving infinity.  But in real-life we don't encounter this because we don't have
> a point

Exactly - and that is why the current implementation is as it is.

> Light sources are going to have a finite, definable surface area.  So
> in case 1 above, we are assuming that FD is the distance to the surface of the
> light source from the theoretical point light.  In that case it doesn't really
> matter what is inside the light source.  Of course using this would typically
> necessitate using small values for FD.  If a large FD is used, then you have the
> problem that you have a constant light with no attenuation for that distance
> which is what the second option was to solve; it treats the point light as if it
> were a finite light and starts the attenuation from there.

The approaches you suggest, however, fail to account for the fact that 
at distances >0 from the light's surface you'll get not only 
illumination from the nearest point on the light's surface, but also 
from all other visible points of the light's surface. To my knowledge, 
the current implementation models this faithfully.

>> (Not to mention that they wouldn't
>> be backward compatible with existing scenes.)
>
> If it was to be implemented, to be backward compatible it could be handled
> similar to attenuation in interior where simply setting the fade_power>1000
> kicks in the alternate function as this would not be a typical value used.

No; that would make the whole thing inconsistent, because if a 
fade_power>1000 would be handled specially, users would likely expect it 
to give exactly the same formula as used with interior fading.

I'm currently toying around with the idea to implement special handling 
for fade_distance = 0 (which currently doesn't mean anything useful) to 
specify that a true 1/x^fade_power formula should be used (corresponding 
to an exact point light source), with the light brightness value 
specifying the intensity at x=1.0.

> The current formula is not the true inverse square formula though, it just looks
> similar from a distance and fixes up the point light/infinite brightness
> problem.  What changes the function is the extra "1+...".

As I previously tried to show, it /is/ sufficiently close to the inverse 
square formula when you specify a small fade_distance, and it is 
actually /more/ realistic than the inverse square formula.


Post a reply to this message

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