How Lighting Works

Let's think about how lighting works for a moment. The first thing we need is a light source, to emit light. We also need an object that can be lit. Finally we need a sensor, like our eyes or a camera, which will catch the photons that are sent out by the light source and reflected back by the object. Lighting changes the perceived color of an object depending on the following:

The light source's type

The light source's color or intensity

The light source's position and direction relative to the lit object The object's material and texture

The intensity with which light is reflected by an object can depend on various factors. We are mostly concerned with the angle at which a light ray hits a surface. The more perpendicular a light ray is to a surface it hits, the greater the intensity with which the light will be reflected by the object. Figure 11-1 illustrates this.

Maximum Reflectance Less Reflectances

Figure 11-1. The more perpendicular a light ray is to a surface, the greater the intensity of the reflected light.

Maximum Reflectance Less Reflectances

Figure 11-1. The more perpendicular a light ray is to a surface, the greater the intensity of the reflected light.

Once a light ray hits a surface, it is reflected in two different ways. Most of the light is reflected diffusely, which means that the reflected light rays are scattered randomly by irregularities of the object's surface. Some reflections are specular, which means that the light rays are bouncing back as if they hit a perfect mirror. Figure 11-2 shows the difference between diffuse and specular reflection.

Diffuse Reflection Specular Reflection

Figure 11-2:.Diffuse and specular reflection

Diffuse Reflection Specular Reflection

Figure 11-2:.Diffuse and specular reflection

Specular reflection will manifest itself as highlights on objects. Whether an object will cast specular reflections depends on its material. Objects with rough or uneven surfaces like skin or fabric are unlikely to have specular highlights. Objects that have a smooth surface, like glass or a marble, do exhibit these lighting artifacts. Of course glass or marble surface aren't really smooth in an absolute sense either. Relative to materials like wood or human skin they are though.

When light hits a surface, its reflection [OK?] also changes color depending, on the chemical constitution of the lit object. The objects we see as red, for example, are those that reflect only the red portions of light. The object "swallows" all other frequencies. A black object is one that swallows almost all of the light that is shone on it.

OpenGL ES allows us to simulate this real-world behavior by specifying light sources and materials of objects.

0 0

Post a comment