Helgard opened this issue on Jun 26, 2010 · 195 posts
bagginsbill posted Fri, 09 July 2010 at 1:11 AM

From first principles, I could show that the attenuation function is actually exponential decay, via calculus. But while that's an interesting little diversion, it's kind of OK to just accept it as truth.
Exponential decay can be expressed in many ways. But the way that I find most useful with regard to a comparison to what we've seen already is like this:
.5 ^ (x / h)
Where h is the distance where the attenuation is exactly 1/2, i.e. the half distance I mentioned.
It's easy to verify why that works. Consider the case where x = h. Then the function is
.5 ^ ( h / h)
which is
.5 ^ 1
which is exactly 1/2.
Now if I want to understand how exponential decay looks compared to the linear falloff that DC implements by default, I would choose to line up the half distance of the exponential decay function with the half distance of the linear DC function.
Recall earlier that the linear DC half distance is b/2. So I want to use b/2 for my h.
.5 ^ (x / (b / 2))
With a little rearranging it should be clear that this is:
.5 ^ (2(x / b))
And so I have changed the graph - the old linear attenuation is now a dotted blue line. The new, correct exponential decay attenuation is the green line.
Some things to note:
They coincide at x = 0 and x = 3, which is the half distance.
In the range 0 <= x <= h, they aren't very different. I like to use the phrase "directionally correct" in a case like this. By that I mean that the linear DC attenuation is pretty close to what it really should be in that range. It starts and ends in the right places, and stays pretty close to the correct value everywhere in between.
After x is greater than h, the linear DC is not directionally correct. It goes to 0, first of all, while the real function never goes to 0. That could be tolerated if it didn't go to zero until the real function was very close to 0. But instead it goes to zero damn fast, while the real function keeps on going with significant non-zero values for quite a while.
This is why the built-in attenuation doesn't look right except for stuff that is close to the camera, closer than the half distance. Those things look pretty much how they should. But everything after the half distance looks totally wrong.
Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)