Quote:Original post by BTierens
The lighting formula is just a dot product, isn't it? If it is, it should be possible for the six different planes of the cubes to have other colors.
Yes, it is. But when the normal is facing away from the light (e.g. light_dir = (0,0,1), normal_dir = (0,0,-1)) the result will be negative (-1) and is zeroed. This is a simplified version of the lighting calculation:
vertex color = emissionmaterial + ambientlight * ambientmaterial + sum over all the lights 0 to N - 1: max( l * n , 0 ) * diffuselight * diffusematerial + max( s * n , 0 ) * shininess * specularlight * specularmaterialN = the number of lights in the scenel = (lx, ly, lz), the unit vector that points from the vertex to the light positionn = (nx, ny, nz), the unit normal vector at the vertexs = (sx, sy, sz), the normalized sum of the vector from the vertex to the lightposition and the vertex to the viewpoint
Note the max() functions. For away facing triangles, this amounts to:
vertex color = emissionmaterial + ambientlight * ambientmaterial
Check this
faq on the details.
Tom