A while ago I was doing lighting. I was pretty much working out how phong shading, specular et all were done from scratch since I prefer to do it that way. Harder, but then I really understand it. I’m not a graphics programmer, but this isn’t that hard.
Or at least it wasn’t until a friend helpfully pointed me at the phong shading wiki page – found here.
There I found the above equation. I’m sorry – it means zero to me. I’m one of those people who can only grok an equation like that if I already know what it means. Looking at that blind and trying to understand what it means? Forget it.
So here’s the ranty bit. The thing is mathematicians build equations like this because they can. They don’t write them to be understood by Joe Schmo. If you are smart enough to read that equation cold, then you don’t actually need the equation in the first place because you are ipso facto smart enough to work out what it’s trying to communicate with you in the first place.
In which case the question has to be asked “why do this?”.
Now I get what the equation is, because I worked it out for myself first. What would help tremendously though is if they used meaningful variable names for a start. Instead of Ip, use Lighting Value. Instead of Ka and Ia, use actual bloody names. It makes decoding it far far easier.
Also, put some bloody example usage in there. It’s really not hard. Do an example – if we have Light X at distance Y from object A and Vertex V is at position whatever etc etc etc. I don’t know about you but I *always* work best from example code because it allows me to truly plug in what I know and deduce the rest. Microsoft is usually pretty good about this although recently it’s been a bit spotty – either you get examples in C++, C# and Visual Basic, or you get nothing.
But back to the point. Wiki pages like the Phong one don’t honestly do a lot of good. If you understand it all, you don’t need the wiki page in the first place. So please, if you intend to explain something mathematical, a) use meaningful names and b) put some damn examples that explains usage and flow of the equation (again with meaningful examples).