Scientists are pulling back the curtain on a mysterious phenomenon - how hallucinations are produced in the brain.