Here’s the same sample as the last one but with lighting added to it. Notice that depth of the shaded colors now vary in detail depending on what type of light is used. Three types of lights are used in this application. Namely Directional/Parallel light(i.e sun), Point light(i.e. light bulb) and Spot light (i.e. ..err.. spot lights). The main formula that makes these lighting work is “Lambert’s Cosine Law”. The screenshots below also uses Phong Shading. Phong shading provides the most detailed but also the most expensive type of shading. Other types of shading are Lambertian and Garraud shading. These two shading types are less expensive but gives lesser shading quality( lower polygon models have triangles more noticeable(forgot the actual word)). For more info see [ELengyel04] or [FLuna08].
[ELengyel04] : Mathematics for 3D Game Programmers & Computer Graphics 2nd Edition
[FLuna08] : Introduction to 3D Game Programming with DirectX 10