Finally, let's add some lighting to the objects in the scene, just to make the objects more interesting to look at. We'll do this by allowing the light renderer to be drawn in the scene. Here, the light is originating from the center of this sphere. Using the position of the light source, we will calculate whether a pixel is lit or not, as follows:
The picture on the left shows the scene unlit. In contrast, the scene on the right is lit with the earth sphere and the ground is affected by the light source. The surface that is facing the light is brightest, for example, at the top of the sphere. This creates a Specular at the top of the sphere. Since the surface is farther from/at an angle to the light source, those pixel values slowly diffuse. Then, there are surfaces that are not facing the light source at all, such as the side of the ground facing us...