User blog comment:SnakeTongue237/A Recent Experience With Sleep Paralysis/@comment-26268104-20161118000126/@comment-28266772-20161123123655

When your brain receives sensory input it takes that information and actively processes it to create perception. Your brain searches through an unfathomable pile of noise and signals and from that it constructs your day-to-day experiences of reality; this process is known as perception. There is not a direct 1:1 link between what your eyeballs receive and what your brain perceives. There are enough visual illusions online to go through this idea without me providing working examples.

Hallucinations occur because your brain's active construction of information goes wrong and starts constructing things that aren't there. This can be due to an absence of sensory input, damaged sensory input or because the way your brain works has been altered due to disease, ordrugs. Where dreams fit into this isn't super clear but an educated guess would say that there's a period between waking and sleeping where your brain is still in "interpret random shit as faces and people all the time" while your eyes are open and your body is paralysed and that's why loads of people get hallucinations when falling asleep/waking up.

Basically your brain searches sensory information for patterns, and hallucinations occur because that search starts incorrectly identifying things that aren't there, we do in fact see patterns occuring in what people hallucinate. What your brain identifies is influenced by a number of things--including the random firing of activity in the brain and your own personal life experience--but a big factor is evolution. You are especially good at finding faces where there are none and in terms of hallucinations people tend to see faces, people, and animals because spotting other living things is a kind of "must-have" feature for humans who don't want to get eaten". Other than that though it's almost always random shit that's mostly influenced by you and your experiences. Raidra mentions seeing other comic book characters. I see spiders and family members. Dreams, in general, tend to be reflective of your recent experiences and what's "on your mind a lot".