Imagine turning on your tap and seeing no water come out. Or looking down into your village’s only well and finding it dust-dry. Much of the developing world could soon face such a scenario. According to the United Nations, 1.2 billion people already suffer from severe water shortages, and that number is expected to increase to 1.8 billion over the next decade, in part because of climate change.

Developed countries probably won’t be immune. California and other states in the western U.S. are already experiencing extreme drought, and climate experts warn of even worse to come—multi-decade megadroughts. Mass migrations and wars over freshwater loom as real possibilities.

Staving off disaster will require conservation, especially in agriculture, which consumes more than two-thirds of all the water humans use. Basic infrastructure maintenance would also go a long way: Some developing countries lose more than half their water through leaky pipes. But conservation and maintenance won’t solve all our water woes, especially as the planet warms and people continue to pack into cities. As a result, governments around the world are investing in new water-recycling and water-harvesting technologies. Here’s what the future of water might look like.

1. Drinking From the Sea …

One obvious solution would be to drink ocean water. Converting seawater into freshwater by stripping out the salt—a process called desalination—offers several advantages. Roughly half the world’s population lives within 65 miles of an ocean, and saltwater accounts for about 97 percent of all water on Earth.

Still, desalination presents obstacles. Older plants that boil seawater and collect the vapors, as many of those in the Middle East do, use ungodly amounts of energy. Newer plants that use reverse osmosis—whereby seawater is forced through membranes at high pressure—are more efficient, but still expensive and energy-intensive. The process also produces a briny waste that can harm marine life if not disposed of properly.

We can nevertheless expect to see more desalination plants soon—thanks in part to Israel, which all but eliminated its chronic water shortages in the past decade by building four large reverse-osmosis plants, inspiring other countries to follow suit. A $1 billion plant operated by an Israeli company is about to open north of San Diego; it will be the largest in the Western Hemisphere, providing up to 50 million gallons of water a day to Californians.

2. … Or From the Toilet

Instead of desalination, some experts favor recycling wastewater—cleaning the water from showers, washing machines, and, yes, toilets—for human consumption.

Most water-recycling plants clean water in two basic ways. First, they force it through filters, some of which have holes hundreds of times narrower than a strand of human hair. These filters remove waste particles, organic chemicals, bacteria, viruses, and other dreck. Second, chemicals like hydrogen peroxide or ozone and pulses of ultraviolet light destroy any pathogens that have slipped through.

Water recycling is a proven technology: California recycles hundreds of millions of gallons each day for irrigation and other uses. So what’s stopping recycled wastewater from going directly to our taps? Human psychology. The very idea of drinking it disgusts many people. They view such water as irredeemably dirty, little better than toilet water.

In reality, recycled water is some of the cleanest drinking water around—as good as or better than the best bottled water. (Breweries in Oregon and California have plans to make beer with recycled water for this very reason—it’s so clean that it’s tasteless, a blank slate.) More to the point, recycled water is far purer than most tap water. By the time the water in the Mississippi reaches New Orleans, for instance, every drop has been used by cities along the river multiple times, and the treatment it gets before going through the taps is nowhere near as extensive as what a water-recycling plant provides.

Singapore and Namibia have recycled water for years with no adverse health effects, and NASA began recycling water on the International Space Station in 2008. (The Russian cosmonauts there don’t recycle their pee, but they give the Americans bags of it to recycle and then drink.) In the United States, a few parched towns in Texas and New Mexico drink recycled wastewater already, and last year the city of San Diego—which gets most of its water from rivers that are running dry—approved a $3 billion recycling plant that would provide one-third of its tap water, 83 million gallons a day, by 2035. San Diego had rejected essentially the same plan in 1998, but this time the city decided it had no other choice.

3. Microbe Power

Rather than filtering out organic waste, water-recycling plants might one day be able to break it down with microbes, a process that could bring an ancillary benefit: electric power.

As they digest the gunk in wastewater, certain species of bacteria, called electricigens, can liberate electrons, the stuff of electricity. Producing electrons is actually common in nature—much of photosynthesis involves shuttling them around. Unlike plants, though, electricigens don’t store electrons internally. They use microscopic appendages that look like hairs to deposit the electrons onto external surfaces, usually minerals. In experimental fuel cells, scientists have replaced the minerals with wires and harvested electrons. Someday the bacteria might even generate enough power to run a water-recycling plant, making it self-sufficient.

4. Keeping It Simple

Some up-and-coming water technologies are startlingly straightforward. People on arid plateaus, for instance, can string a fine plastic mesh between two posts and use it to capture water from fog that rolls through, collecting the drops in storage tanks. Existing systems in one small Guatemalan village can collect 6,300 liters a day, and more during the wet season. Scientists think that updating the mesh with new materials and tighter weaves could dramatically improve yields. People could even channel the water into hydroponic gardens to grow food. Imagine famously foggy San Francisco with a farm on every rooftop.

Oil films present another low-tech opportunity. Reservoirs lose appalling amounts of water to evaporation: By some estimates, more water escapes into the air than is used by humans. But covering the surface with an extremely thin layer—even just one molecule thick—of nontoxic chemicals derived from coconut or palm oil can cut evaporative losses.

Wind tends to break up layers of oil, re-exposing the water to the elements. But drones or blimps equipped with sensors could someday monitor reservoirs and signal where oil needed to be re-applied. In one recent test, spreading oil over a lake in Texas (via boats) appears to have cut evaporation by about 15 percent.

5. Making It Rain

Of course, for every modest proposal to save water, there’s an audacious one floating around. Take weather modification. Advocates of the idea hope to significantly boost precipitation using a process called “cloud seeding”: spraying clouds with a chemical like silver iodide, which acts as a nucleus around which water droplets collect. The droplets then fall to Earth as rain or snow.

That’s the theory, at least. The first large-scale experiments, in the 1940s, generated a lot of excitement. More recently, weather modification has been dogged by accusations of hype and questions about its reliability. A six-year program in Wyoming claimed to have squeezed 5 to 15 percent more precipitation out of the clouds it seeded. Unfortunately, conditions were suitable for seeding only 30 percent of the time, so the total increase in precipitation was closer to 3 percent. That’s not nothing, especially during droughts. But weather modification may be the flying car of water technology—a tantalizing idea that’s forever on the horizon.

6. The Moon Shot

If Earth does run dry, we might be able to save ourselves by mining water from asteroids and comets. Scientists have landed probes on these space rocks to study them. Future landers could mine them in deep space or possibly even drag them back toward Earth. Though the idea sounds far-fetched, space-mining companies already exist, and one of them, Planetary Resources, expects to start harvesting resources from asteroids in about a decade.

According to Planetary Resources, a single 1,600-foot-wide asteroid could yield more platinum than has ever been mined in human history. But water could prove to be the real prize for space-mining companies. Some astronomers believe that the asteroid Ceres, which sits between Jupiter and Mars, may contain more freshwater (as ice) than all of Earth does. In addition to quenching people’s thirst, this water could be turned into fuel for interplanetary spaceships. In that case, an ample supply of water would be the key to a happy future not just down here on the ground, but up among the stars as well.

A Brief Chronicle of Water

Circa 8500 to 7000 b.c.: Some of the world’s oldest known wells are dug on Cyprus.

A.D. 226: Rome completes the last of its 11 aqueducts, which span a total of more than 250 miles.

1945: Fluoride is added to the water in Grand Rapids, Michigan. The cavity rate among schoolchildren drops by about 60 percent.

1951: The U.S. Congress rather optimistically considers a a bill calling for “equitable distribution of precipitation among the states” through weather modification.

2014: Scientists conclude that Earth has likely had water since soon after it formed nearly 4.6 billion years ago. (Earlier theories held that water arrived much later via asteroids or comets.)

2035: Companies begin harvesting water from asteroids in deep space.