POV-Ray : Newsgroups : povray.general : Light Attenuation : Re: Light Attenuation Server Time
21 Apr 2024 04:50:55 EDT (-0400)
  Re: Light Attenuation  
From: Trevor G Quayle
Date: 12 Mar 2011 09:40:01
Message: <web.4d7b850f315d1becb05ef170@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> 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.

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.

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.

In either case, the light value you put in is the magnitude of the light at
light surface (r=FD).

I have already shown the difference in the graphic posted at p.b.i if you had a
look.  I am going to try to simulate it in my Matinee scene by using a constant
light (no fading) but apply the function to the media density, just to see how
different the effect is.

-tgq


Post a reply to this message

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