It’s a tired trope in movies and cartoons: The characters are wandering in the desert, desperate for water, when up ahead, they see an oasis. Water at last! (In cartoons, the water is often surrounded by swaying palm trees and deck chairs.)
But alas, there is no oasis — no water at all, not even a small pool. It was just a mirage. We even use ‘mirage’ as a metaphor: I imagined us together for the rest of our lives, but that future was just a mirage. But what are mirages when you get them away from movies and metaphors?
A mirage is an optical illusion that occurs when light rays bend due to refraction in layers of air with different densities. This phenomenon creates the appearance of a distant object or scene, which is deceptive because it does not physically exist at that location.
Read More: Optical Illusions Are Weirder Than You Think
As weird as they seem when you see one, the science behind a mirage is not weird at all, just some simple physics. Optics, to be precise.
Here’s how they work: When the ground temperature is very hot, the air just above the ground gets hot, too. This air lower to the ground is hotter than the air above it, which is denser because it is cooler than the hotter air below.
When light moves through air of uniform density, it travels in a straight line. However, it bends or warps when it hits a patch of air with different densities. This is called refraction, so when light coming from above hits that boundary where hot and cooler air meet, it curves back up, making a wide U-shaped curve.
When that light reaches our eyes, our brains assume the light came in a straight line, as light is wont to do. Our brains, quite sensibly but inaccurately, interpret the light as coming from the ground. On top of that, the light looks like water. That’s because the light at the boundary between these two densities works something like a mirror, reflecting the sky, creating the impression that you’re looking at a pool or lake.
So, the oasis you thought you saw is actually just a reflection of the sky. Too bad if you’re wandering the desert in search of water, but otherwise, it’s pretty cool.
You don’t have to be lost in the desert to see a mirage. You can get the same effect anytime the ground heats up the air just above it, creating those different densities.
One common place a mirage can occur is on a hot road, where the mirage often makes it look as if there’s water on the road ahead. But mirages can sometimes occur on a beach or a field as well.
The type of mirage we’ve been talking about is called an inferior mirage. But it’s not the only kind. Superior mirages occur when the warmer air is above, not below, the cooler air. This often happens on water when sunlight passes through warmer air to the cooler air near the water.
This causes the light to bend down rather than up toward you, as was the case in the desert. A superior mirage can make the object you’re looking at appear higher than it is. When this happens while you’re looking at a boat on the water, it can seem as if the boat is floating in the sky. Some have suggested that this is how the legend of the Flying Dutchman originated.
A Fata Morgana, named after Morgan le Fay, the enchantress of Arthurian legend, is an especially complex mirage due to vertical as well as horizontal differences in the densities of air.
This phenomenon got its name because superior mirages that were often seen in the cold waters of the Strait of Messina between Sicily and Southern Italy (Fata Morgana is Italian for Morgan le Fay) looked like rocky or icy cliffs and floating castles or towers conjured by the sorceress.
Unless you’re wandering in the desert desperate for water or being duped into thinking you’ve found a magic castle, mirages are one of nature’s more delightful effects.
Read More: How to Grow a Phantom Finger