It only takes a glance at a history book and a look out the window to know that our planet has lost many of its biggest creatures: The world that was once home to mammoths and towering dinosaurs can now barely maintain stable populations of rhinos and whales. But according to a new study, we’ve got more to mourn than just the animals themselves. We’ve lost their feces, too — and that’s a bigger problem than you might think.

Why should we miss steaming piles of dinosaur dung? According to research published Monday in the Proceedings of the National Academy of Sciences, megafauna play a greater role in the spread of nutrients across the planet than scientists ever realized.

The research focused on modeling the distribution of phosphorus , a nutrient necessary for fertilizing plant growth. Scientists know that animals help carry these nutrients around by, well, not pooping where they eat. Without this process, nutrients would end up following gravity onto the ocean floor, instead of spreading as high as the mountain tops. But these days most of the nutrient recycling that happens is due to bacteria — not wandering poopers.

“I wanted to know whether the world of the past with all the endemic animals was more fertile than our current world,” lead study author Chris Doughty of Oxford University told The Post.

“Large free-ranging animals are much less abundant than they once were. Today, if scientists were to study the role of animals they would find that it is important but small,” Doughty explained. “However, in the past, we hypothesize that it would have been at least an order of magnitude larger than today. Essentially, we have replaced wild free-roaming animals with fenced domestic cattle that cannot move nutrients in the same way.”

Some of these contributors — the massive land animals that once roamed our planet — are gone for good. But others are dwindling before our very eyes. In one example of the effect, the researchers found that whales — which have seen dramatic population loss in the last century, mainly due to hunting and habitat disruption — used to bring an estimated 750 million pounds of phosphorus up from the deep ocean to the surface each year. Since whales feed deep in the water and come up to breathe — and poop — at the surface, they’re great at helping to recycle these resources.

But today, the researchers estimate, whales only bring 165 million pounds of phosphorus up annually. That’s just 23 percent of their previous contribution. Phosphorus movement by birds and fish that come inland after eating in the sea (like salmon, for example) are just 4 percent what they once were.

There’s some good news: Some efforts to restore whale populations have been wildly successful. “It was a relatively simple process,” study co-author Joe Roman of the University of Vermont told The Post. “Stop killing them, halt commercial whaling, and they will return.” But some whale populations are still struggling — there are still just a few thousand blue whales out in the wild, for example.

The study authors warn that easily accessible phosphorus could disappear in as little as 50 years. Continuing to push for the recovery of these whales — and other large animals — could make a big difference.

“A world bereft of large wild animals, whether they are whales, salmon, albatrosses, or elephants, is a less productive place — and one that has lost much of its magic,” Roman said. “We can turn these effects around by restoring native populations of large vertebrates around the globe.”