The lighting formulas are elaborated here:

http://www.conitec.net/beta/lighting.htm

Maybe this is of some help for you?


Always learn from history, to be sure you make the same mistakes again...