it's not that hard:
you start with photoreceptive cells (not so hard to imagine since even amoeba can display photokinesis)
this would give the creature the ability to distinguish between light and dark, and using it, possibly find food sources/evade predators or whatever.
the next step is a thin ridge around the photoreceptive patch. this would allow shadow, and hence a slight amount of directionality.
the ridge gets higher, eventually curling round to a ball, the ideal shape if you want to localise a spot somewhere on the photoreceptive patch, improving direction et al. (note the nervous system also has to improve to cope with this additional information, but it's all gradual)
then you have imaging and so on, which granted is more complicated, but still doable.