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

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

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

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

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+...".

> (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?)

Yes, this is what I am using.

I know all of this doesn't really make a difference, as people are not going to
notice one way or the other or that it isn't quite the right falloff.  I just
got curious about it when trying to adjust my light fading.


Post a reply to this message

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