I am learning a little calculus (very little ), and I am feeling a little impatient. I want to write a shader (completely unnecessary since OpenGL can handle lighting, but it's a puzzle I'd like to solve for several other reasons) and this is a useful bit of math involved apparently. But again, I am not hardcore in math, so I need some assistance. Can anyone help point me to resources covering the math involved in this technique or lay out the exact equation/s behind it? I found a possible solution that gives at least an approximation, for most situations, on yahoo answers which I'll try after this post, but I was wondering if there are any equations for handling every problem set definitively. I appreciate the help.

http://answers.yahoo.com/question/index?qid=20121229103849AACTgSg&r=w