First, I accept evolution. The eye thing is weak. They sunburned nerve end doesn't do it for me. BUT here is what is conjectured. The simple light-sensitive spot on the skin of some ancestral creature gave it some tiny survival advantage, perhaps allowing it to evade a predator. Random changes then created a depression in the light-sensitive patch, a deepening pit that made "vision" a little sharper. At the same time, the pit's opening gradually narrowed, so light entered through a small aperture, like a pinhole camera.
Bookmarks