Original Post
http://www.flipcode.com/tutorials/tut_dx8shaders.shtml
I was looking through this tutorial on doing my own lighting with vertex shaders. Unfortunatly I don't know how the attenuation function works. Attenuation is the decay of the light over time. The function he uses here has three variables you can use to change the light. Does anyone know what they really are? I mean this is an excerpt from the tutorial:
fatt = 1/(A0 + A1 * dl + A2 * dl * dl)
(dl is distance to light)
In the above equation, A0, A1 and A2 are known as the attenuation constants.
As d goes to infinity, attenuation becomes very small but not zero.
By varying the three constants A0, A1, A2, interesting effects can be achieved.
Radial distance falloff: A1 = 0 and A2 > 0
Linear falloff: A1 > 0 and A2 = 0
If the light is too close to the surface, then, attenuation becomes very large, making the light too bright. To avoid this, set A0 to 1 or greater.
I am writing an exporter for max so I can take the lights from max and display them in my game. I don't know how to change a float (farAtten in MAX) into these three constants. Any help clearing up this matter is greatly appreciated.
-Greg
[edited by - Greg K on December 23, 2002 3:42:24 AM]