POV-Ray : Newsgroups : povray.general : Light Attenuation : Re: Light Attenuation Server Time21 Apr 2024 04:21:16 EDT (-0400)
 Re: Light Attenuation
 From: clipka Date: 12 Mar 2011 02:42:09 Message: <4d7b23d1\$1@news.povray.org>
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#4d7b23d1%241%40news.povray.org",
"dateCreated": "2011-03-12T07:42:09+00:00",
"datePublished": "2011-03-12T07:42:09+00:00",
"author": {
"@type": "Person",
"name": "clipka"
}
}
Am 11.03.2011 22:52, schrieb Trevor G Quayle:

> However, I am not fully convinced the light fading model being used is correct.
> For inverse square, I would think the genral function would be:
>
> a= FD/(x^2)
>
> There is a difference between this function and the one used: at x=1, the
> functions are equal, however as x increases, the function used overcalculates
> the value (eg, x=1.3 +25%, x=2.0 +60%, x=inf +100%).  Below x=1, the function
> undercalculates the value (eg, x=0.7 -34%, x=0.5 -60%).

The formula is defined as it is to account for the fact that real light
sources are not point light sources.

> I have posted a graphic in p.b.i to illustrate the differences.  Perhaps
> generally the differences in a scene may seem subtle, but there may be
> circumstances (eg, my Matinee scene) where it can make a difference.  The light
> fading of the projector 'looks' ok, as we don't have any reference, but in
> reality, the decay should occur quicker. One way to get closer I suppose, is to
> use a higher fade power in the formula (oddly, using exp(1) for the power gives
> a reasonable balance between x=1 and x=4 with a variance from +12% to -28%),
> however it is still not technically correct (perhaps that just bothers me as a
> perfectionist...)

The proper way to do it would be to reduce fade_distance to a very small
value, and increase the light intensity to compensate.

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.
```