Getting Attenuation -Right-

Ok, so I’ve just read about 30 posts between the 2 boards that have the word attenuation in it, and havent found my answer.

I’ve read the Red Book which is quite vague on this subject. Even Nate didn’t have a nice demo

What I want to do as many here before have asked is specify a ‘range’ value for the ‘falloff of light’ over a distance.

I use an octree to cull the objects that are affected by a light. I do this by specifying a ‘sphere of effect’ for the light. That work fine.

What I need is to have a nice falloff that will have an Red Book:‘attenuation factor’ I guess of ~0 when I reach the sphere’s radius. (ok, so 0 might not be possibly but very small is ok)

I do the test on a grid of objects so I’ll be able to see easily if there is too much light at the maximum range as adjacnt object will have no lighting at all.

Is anyone able to give some suggestions at to any \ all attenuation values I’ll need to set to get fairly complete falloff over a specified distance?

Many thanks


For each light, you’ll have to set


where ‘q’ is a factor of quadratic attenuation.

I quote from the man page of glLight:

“If the light is positional, rather than directional, its intensity is attenuated by the reciprocal of the sum of: the constant factor, the linear factor times the distance between the light and the vertex being lighted, and the quadratic factor times the square of the same distance”.

I use a factor q of about 1/2000, and that attenuates fine over a range of zero to about sixty on GL space units. You’ll have to do some math about how many light is a good absolute dark, because no matter how big q becomes, still a very little quantity of light will “exist” outside of the bubble; after some threshold it becomes unperceivable.

[This message has been edited by FermatSpiral (edited 08-28-2002).]