This following link discusses the phenomenon in terms of phosphenes:
https://www.huffpost.com/entry/why-do-i-see-patterns-when-i-...
Arguably, there have been spiritual movements fueled by relative ignorace around these things, with gurus allegedly claiming that they enable these unexpected experiences for their disciples.