Pro OpenGL ES for iOS

(singke) #1

92 CHAPTER 4: Turning On the Lights^


to fully understand how to take colored pigments suspended in oil and to apply them on
a canvas to create a believable rainbow at the base of a waterfall. Such is the task of
OpenGL ES when it comes to turning on the lights in our scenes.
Sans poetry, light is merely a portion of the full electromagnetic spectrum that our eyes
are sensitive to. The same spectrum also includes radio signals that our iPhones use, X-
rays to aid a physician, gamma rays sent out from a dying star billions of years ago, and
microwaves that can be used to reheat some pizza left over from Wii Bowling Night last
Thursday.
Light is said to have four main properties: wavelength, intensity, polarization, and
direction. The wavelength determines the color that we perceive, or whether we can
actually see anything in the first place. The visible spectrum starts in the violet range,
with wavelengths of around 380 nanometers, on up to red, with a wavelength of around
780 nanometers. Immediately below is ultraviolet, and right above the visible range you’ll
find infrared, which we can’t directly see but can detect indirectly in the form of heat.
The way we perceive colors from objects has to do with what wavelengths the object or
its material absorbs or otherwise interferes with the oncoming light. Besides absorption,
it could be scattered (giving us the blue of the sky or the red of the sunset), reflected,
and refracted.
If someone says that their favorite color is white, they must mean that all colors are their
favorite because white is a summation of all colors of the visible spectrum. If it is black,
they don’t like any colors, because black is the absence of color. In fact, that is why you
shouldn’t wear black on a nice warm sunny day. Your clothing absorbs so much energy
(in the form of light and infrared) that some of that ultimately turns into heat.

Note When the sun is straight overhead, it can deliver an irradiance of about 1 kilowatt for
every square meter. Of that, a little more than half is infrared, sensed as a very warm day,
while a little less than half is visible light, and a measly 32 watts are devoted to UV.

It is said that Aristotle developed the first known color theory. He considered four colors,
each corresponding to one of the four elements of air, earth, water, and fire.
However, as we look at the visible spectrum, you will notice a nice contiguous spread
from violet on one end to red on the other that has neither water nor fire in it. Nor will
you see discrete values of red, green, or blue, typically used nowadays to define the
individual shades. In the early 19th century, British polymath Thomas Young developed
the tricolor model that uses three colors to simulate all visible hues. Young proposed
that the retina was made up of bundles of nerve fibers, which would respond to varying
intensities of red, green, or violet light. German scientist Hermann von Helmholtz later
expanded this theory in the mid-19th century.
Free download pdf