All dreams come from the subconscious. Nightmares are from the subconscious trying to tell you that you need to be aware of something happening in your life right now. If I want to warn you about something, I can yell, touch you, shake you, or hit you between the eyes with a 2 x 4. The subconscious cannot physically touch you to let you know it wants your attention, so it uses nightmares. It is really quite simple.