I needed help with figuring out how to shade a polygon face in my primitive 3d rendering engine. Interactive mind, you gave me a solution, I want to see if these are the correct steps:
1) Find center (x,y,z) point of the face by averaging the location of its vertices.
2) Find the vector that points from the center point above to the light source (p).
Q: What is my light source anyways? I mean, do I just pick an x,y,z lightsource somewhere in my scene and that's it? I'd like to use just a constant directional light I think.
3) Find the surface normal of the face (N).
4) Find the cosine of the angle between p and N (A).
5) Multiply each RGB component of my face color by Cos A.
Q: What does that look like? Take a fictional RGB component (128, 50, 0):
double d = cos(A);
r = 128 * d;
g = 50 * d;
b = 0 * d;
I know the extra bit to make it a bit more realistic was added, but if I can get the above working first that will be a good start.