A relatively simple proto-eye is the pineal gland. It has been considered to be the third eye and it is involved in circadian rhythms in man, it is involved in thermo regulation, and in reptiles and amfibians it is in fact directly light-sensitive.
However, it is not an eye as such, because the pineal does not convey topographical information about the environment to the brain. It is more of a light sensor in reptiles and amfibians. However, it is a sensor embedded in the central nervous system of higher organisms including humans. As such, it is not just a light sensor, but an endocrinic organ involved in the light-based entrain of endogenous circadian clocks present in various organs. It has been implicated to be an integral part of the visual system in early life:
hypothetic four-eyed protovertebrate. Source: Vigh et al., 2002
The hypothetical system in the picture is not so much different from the lancet fish today, a 'living fossil'. In early life, and reptiles and amfibians today, the pineal is directly light-sensitive and thereby entrains the circadian clock directly via endocrinic functions. Synchronizing the circadian clock helps organisms to adapt to the environmental light periods, in other words prepare diurnal creatures to wake up in the morning and get ready to hunt etc. Hence it aids survival of various species in different biotopes (Vigh et al., 2002). In humans and other mammals with a dense, solid skull light-sensng is taken over by the retina, as the skull prevents admission of light. Here the pineal has only an endocrinic function receiving afferent input from the eye.
Vigh et al., Histol Histopathol 2002;17:555-90