Evolution of the eye
The evolution of the eye has been a subject of significant study, as a distinctive example of a homologous organ present in a wide variety of species. The development of the eye is considered by most experts to be monophyletic; that is, all modern eyes, varied as they are, have their origins in a proto-eye believed to have evolved some 540 million years ago. The majority of the process is believed to have taken only a few million years, as the first predator to gain true imaging would have touched off an "arms race". Prey animals and competing predators alike would be forced to rapidly match or exceed any such capabilities to survive. Hence multiple eye types and subtypes developed in parallel.
Eyes in various animals show adaption to their requirements. For example, birds of prey have much greater visual acuity than humans and some, like diurnal birds of prey, can see ultraviolet light. The different forms of eye in, for example, vertebrates and mollusks are often cited as examples of parallel evolution. As far as the vertebrate/mollusk eye is concerned, intermediate, functioning stages have existed in nature, which is also an illustration of the many varieties and peculiarities of eye construction. In the monophyletic model, these variations are less illustrative of non-vertebrate types such as the arthropod (compound) eye, but as those eyes are simpler to begin with, there are fewer intermediate stages to find.

# History of research
How a complex structure like the projecting eye could have evolved is often said to be a difficult question for the theory of evolution. Charles Darwin famously treated the subject of eye evolution in his Origin of Species:
To suppose that the eye, with all its inimitable contrivances for adjusting the focus to different distances, for admitting different amounts of light, and for the correction of spherical and chromatic aberration, could have been formed by natural selection, seems, I freely confess, absurd in the highest possible degree. Yet reason tells me, that if numerous gradations from a perfect and complex eye to one very imperfect and simple, each grade being useful to its possessor, can be shown to exist; if further, the eye does vary ever so slightly, and the variations be inherited, which is certainly the case; and if any variation or modification in the organ be ever useful to an animal under changing conditions of life, then the difficulty of believing that a perfect and complex eye could be formed by natural selection, though insuperable by our imagination, can hardly be considered real.
However, he has a partial explanation, by his own words too brief and imperfect, which nonetheless set the pattern for later research:
In the Articulata we can commence a series with an optic nerve merely coated with pigment, and without any other mechanism; and from this low stage, numerous gradations of structure, branching off in two fundamentally different lines, can be shown to exist, until we reach a moderately high stage of perfection. In certain crustaceans, for instance, there is a double cornea, the inner one divided into facets, within each of which there is a lens-shaped swelling. In other crustaceans the transparent cones which are coated by pigment, and which properly act only by excluding lateral pencils of light, are convex at their upper ends and must act by convergence; and at their lower ends there seems to be an imperfect vitreous substance. With these facts, here far too briefly and imperfectly given, which show that there is much graduated diversity in the eyes of living crustaceans, and bearing in mind how small the number of living animals is in proportion to those which have become extinct, I can see no very great difficulty (not more than in the case of many other structures) in believing that natural selection has converted the simple apparatus of an optic nerve merely coated with pigment and invested by transparent membrane, into an optical instrument as perfect as is possessed by any member of the great Articulate class.
All light-sensitive organs rely on photoreceptor systems employing a family of proteins called opsins, which, by structural and sequence homology can be shown to be of common origin. Indeed, the seven sub-families of opsins existed in the common animal ancestor. Recent genetic discoveries have provided valuable evidence for the common ancestry of the eye, as the PAX6 gene has been recognized as a universal "master control" gene for production of eyes in species ranging from mice to humans to fruit flies.
In 1802, William Paley claimed that the eye was a miracle of design.  Since then, it has often been claimed that the eye is too complex to have evolved in any reasonable time-frame.  To examine this claim empirically, Dan-Erik Nilsson and Susanne Pelger  demonstrated that a primitive optical sense organ could evolve into a complex human-like eye within a reasonable period (less than a million years) simply through small mutations and natural selection.  Pro-intelligent design writer  Dr. David Berlinski has criticized the findings in the public arena, questioning the basis of the calculations.  The original authors and other scientists responded by addressing Berlinski's concerns, including a  challenge to submit a paper of his own to a peer-reviewed journal.

# Stages of eye evolution

## Early eyes
The basic light-processing unit of the eye is the photoreceptor, a specialized cell consisting of two molecules in a membrane: the opsin, a light-sensitive protein, surrounding the chromophore, a pigment that distinguishes colors. When a photon is absorbed by the chromophore, a chemical reaction causes the photon's energy to be transduced into electrical energy and relayed to the nervous system. These photoreceptor cells form part of the retina, a thin layer of cells that relays visual information to the brain.
It is likely that a key reason eyes specialize in detecting a specific, narrow range of wavelengths on the electromagnetic spectrumthe visible spectrumis because the earliest species with eyes were aquatic, and only two specific ranges of electromagnetic radiation can travel through water, the most significant of which is visible light. This same light-filtering property of water also influenced the photosensitivity of plants.
The earliest predecessor of the eye was a simple patch of photosensitive cells, physically similar to receptor patches for taste and smell, called an "eyespot". Eyespots can only sense ambient brightness: they can distinguish light from dark, but can not distinguish shapes or determine the direction light is coming from. Some organisms covered the spot in transparent skin cells for protection. Eyepatches are found in nearly all major animal groups, and are common among lower invertebrates such as the unicellular euglena. The euglena's eyespot, called a stigma, is located at its anterior end, has a red pigment, and allows the organism to move in response to light, often to assist in photosynthesis.
The patch gradually depressed into a cup, which first granted the ability to discriminate brightness in directions, then in finer and finer directions as the pit deepened. While flat eyespots were ineffective at determining the direction of light, as a beam of light would activate the exact same patch of photo-sensitive cells regardless of its direction, the "cup" shape of the pit eyes allowed very limited directional differentiation by changing which cells the lights would hit depending upon its angle. Pit eyes, which had arisen by the Cambrian period, were seen in ancient snails, and are found in some invertebrates living today, such as planaria. Planaria can slightly differentiate the direction and intensity of light because of their cup-shaped, heavily-pigmented retina cells, which shield the light-sensitive cells from exposure in all directions except for the single opening for the light. However, this proto-eye is still much more useful for detecting the absence or presence of light than its direction; this gradually changes as the eye's pit deepens and the number of photoreceptive cells grows, allowing for increasingly precise visual information.
During the Cambrian explosion, the development of the eye accelerated rapidly, with radical improvements in image-processing and detection of light direction. As certain organisms benefited from the dramatic advantages given by full-fledged eyes, many other organisms were forced to evolve similarly advanced eyes in order to compete. As a result, the majority of major developments in eyes are thought to have occurred over the span of only a few million years. In the book In the Blink of an Eye, Andrew Parker discusses a theory that the evolution of the eye was the catalyst for the Cambrian Explosion. 
The "pinhole camera" eye was developed as the pit deepened into a cup, then a chamber. By reducing the size of the opening, the organism achieved true imaging, allowing for fine directional sensing and even some shape-sensing. Eyes of this nature are currently found in the nautilus. Lacking a cornea or lens, they provide poor resolution and dim imaging, but are still a major improvement over the early eyespots.
Overgrowths of transparent cells prevented contamination and parasitic infestation. The chamber contents, now segregated, could slowly specialize into a transparent humour, for optimizations such as colour filtering, higher refractive index, blocking of ultraviolet radiation, or the ability to operate in and out of water. The layer may, in certain classes, be related to the moulting of the organism's shell or skin.

## Lens formation and diversification
The transparent cells over the pinhole eye's aperture split into two layers, with liquid in between. The liquid originally served as a circulatory fluid for oxygen, nutrients, wastes, and immune functions, allowing greater total thickness and higher mechanical protection. In addition, multiple interfaces between solids and liquids increase optical power, allowing wider viewing angles and greater imaging resolution. Again, the division of layers may have originated with the shedding of skin; intracellular fluid may infill naturally depending on layer depth.
Note that this optical layout has not been found, nor is it expected to be found. Fossilization rarely preserves soft tissues, and even if it did, the new humour would almost certainly close as the remains desiccated, or as sediment overburden forced the layers together, making the fossilized eye resemble the previous layout.
Vertebrate lenses are composed of adapted epithelial cells which have high concentrations of the protein crystallin. The refractive index gradient which makes the lens useful is caused by the radial shift in crystallin concentration in different parts of the lens, rather than by the specific type of protein: it is not the presence of crystallin, but the relative distribution of it, that renders the lens useful.
It is biologically difficult to maintain a transparent layer of cells as sizes, therefore the thicknesses, gradually increased. Deposition of transparent, but nonliving, material eased the need for nutrient supply and waste removal. In trilobites, the material was calcite; in humans, the material is crystallin. A gap between tissue layers naturally forms a biconvex shape, which is optically and mechanically ideal for substances of normal refractive index. A biconvex lens confers not only optical resolution, but aperture and low-light ability, as resolution is now decoupled from hole sizewhich slowly increases again, free from the circulatory constraints.
Independently, a transparent layer and a nontransparent layer may split forward from the lens: a separate cornea and iris. (These may happen before or after crystal deposition, or not at all.) Separation of the forward layer again forms a humour, the aqueous humour. This increases refractive power and again eases circulatory problems. Formation of a nontransparent ring allows more blood vessels, more circulation, and larger eye sizes. This flap around the perimeter of the lens also masks optical imperfections, which are more common at lens edges. The need to mask lens imperfections gradually increases with lens curvature and power, overall lens and eye size, and the resolution and aperture needs of the organism, driven by hunting or survival requirements. This type is now functionally identical to the eye of most vertebrates, including humans.

## Other developments
The retina may revert on itself, forming a double layer.  The nerves and blood vessels can migrate to the middle, where they do not block light, or form a blind spot on the retina.  This type is seen in squids, which live in the dim oceans.  In cats, which hunt at night, the retina does not revert.  Instead a second, reflective layer (the tapetum) forms behind the retina.  Light which is not absorbed by the retina on the first pass may bounce back and be detected. As a predator, the cat simply accommodates blind spots with head and eye motion.
The ability to see colors presents distinct selective advantages for species, such as being better able to recognize predators, food and mates. As opsin molecules were subtly fine-tuned to detect different wavelengths of light, at some point, color vision developed when photoreceptor cells developed multiple pigments. As a chemical instead of mechanical adaptation, this may have occurred at any of the early stages of the eye's evolution, and the capability may have disappeared and reappeared, as organisms became predator or prey. Similarly, night and day vision emerged when receptors differentiated into rods and cones, respectively.
Some species move the lens back and forth, some stretch the lens flatter.  Another mechanism regulates focusing chemically and independently of these two, by controlling growth of the eye and maintaining focal length.  Note that a focusing method is not a requirement.  As photographers know, focal errors increase as f-number decreases.  Thus, countless organisms with small eyes are active in direct sunlight and survive with no focus mechanism at all.  As a species grows larger, or transitions to dimmer environments, a means of focusing need only appear gradually.

# In creationism and intelligent design
The eye is a famous example of a supposedly "irreducibly complex" structure: due to its many elaborate and interlocking parts, seemingly all dependent upon one another for proper functioning, it is frequently claimed that the eye could not have evolved through gradual, step-by-step, evolutionary improvements guided only by natural selection.
Michael Behe used the "development of the eye problem" as evidence for intelligent design in his controversial book, Darwin's Black Box, and creationist website Answers in Genesis describes the eye as evolutionary biologists' "greatest challenge as an example of superb 'irreducible complexity' in God's creation".
The argument that the eye could not have evolved is most commonly invoked in questions such as "What good is half an eye?" The assumption is that an incomplete eye would be completely useless for sight, and therefore an eye could never have evolved through the gradual, step-by-step progression required by modern evolutionary theory. However, this claim has been heavily disputed based on the plentiful evidence of suboptimal eyes in nature. Such eyes, despite their shortcomings, tend to be dramatically more useful for organisms than no eyes at all would be: people with visual impairments are generally much more able to function normally than people who are completely blind, and there are millions of species of animals with significantly simpler eyes than humans that nonetheless thrive, and are in many cases much more successful than similar species with still poorer vision. Thus eyes with decreased functionality, in humans and in numerous other species, still tend to be more beneficial than having no eyes at all.
Conversely, the human eye is suboptimal compared to what many would consider to be "lesser animals."  Human visual acuity is, in daytime, noticeably less than that of raptors in terms of spatial resolution, and significantly less than various insects in terms of spectral range.  At night, visual acuity is less than predators such as raptors and cats, and invertebrate molluscs such as squid and octopuses.  The visual champion, however, is currently the mantis shrimp.  This invertebrate possesses polarization capability, hyperspectral capability (with three to four times the number of receptors by  range as humans, without including interpolation, over a wider spectral range), and triple redundant depth perception from both their eye constructions and their multiple eyestalk motions (both 2D tracking, and axial rotation).  The fact that these capabilities are achieved using a compound eye layout is especially notable, and a sign of radically divergent evolution.  Thus, the vertebrate layout can be considered half (perhaps even a third or less) of an eye compared to the mantis shrimp form, while still being "good" in many respects.
Although the eye remains a common and popular example of complexity in arguments against evolution, some intelligent design and creationism advocates have abandoned the eye as an example of "irreducible complexity".  As the detail and history of eye evolution have become better understood, its role in these circles has declined and been replaced by molecular and microscopic structures such as the flagellum.  However, much as with the eye, research into these smaller-scale structures has also uncovered details of their evolution.
The eye argument might be said to stem from a "God of the gaps" strategy, or more broadly, the "argument from incredulity" fallacy.