How are hallucinations generated, is it related to dreaming? I was thinking how powerful auditory and visual hallucinations must be, for the individual experiencing them to be unable to distinguish them from reality. I, personally, have not experienced a hallucination, but have experienced vivid dreams and know that when I'm dreaming it can seem real, and at that point, that is my reality (even though I am asleep).

Is there a correlation between the part of the brain responsible for dreaming and hallucinations?

What generates hallucinations, to make them indistinguishable from reality?
Psychosis results in hallucinations. States of psychosis are thought to be like seizures caused by imbalanced levels of at least dopamine and serotonin. Psychosis like depression creates new pathways in the brain which allow for the senses to be flooded with internal information. The person who is experiencing hallucinations may be forced by the psychosis to think that it is real. Some are able to realize that the hallucination is not real. For instance, it is a common condition of humanity to have isolated instances of hallucinations. People hear music when there is none or think someone calls their name but no one did. Normal people are able to recognize that there was no music and no one called their name. 

Psychosis can be caused by extreme excitement. Excitement alone impairs judgment but if it goes to an extreme a person can become psychotic and begin to hallucinate or have other odd behaviour.

Often times people schizo type and bipolar disorder are accompanied with insomnia. If the illness progresses far enough the sick person can become caught in a state between awake and asleep. The hallucinations are combined with greater degrees of dissociation (day dream).