Depends on the drug. Mushrooms have psilocybin. Weed has THC. Other drugs, like cocaine or lsd, are more or less pure substances that directly affect you.
In a very broad sense, these chemicals interfere with your brain chemistry. They activate pathways in chaotic ways, link parts of the brain that are not normally linked. If your subconscious is linked to your visual centers, you get visual hallucinations.
Latest Answers