Dung beetles record a mental image of the positions of the Sun, the Moon and the stars and use the snapshot to navigate, according to researchers.
Scientists in Sweden found that the beetles capture the picture of the sky while dancing on a ball of manure.
As they roll away with their malodorous prize, the beetles compare the stored image with their current location.
The beetles’ navigational skills could aid the development of driverless vehicles, the researchers suggest.
Previous studies have shown that dung beetles have an amazing ability to navigate by the light of the Milky Way.
This new research builds on that work and shows how the store and use the images of the sky inside their brains.
There are many thousands of species of dung beetles all over the world, which thrive on steaming piles of animal waste.
Some of these creatures have evolved ways of grabbing and shaping dung into a ball and rapidly rolling it away from the scrum of competitors.
These beetles then bury the manure and use the balls as a food source and a nursery for their young.
Navigation, however, is critical to the whole enterprise and now scientists in Sweden have discovered new details about their extraordinary skills.
The researchers carried out their experiments in South Africa at a facility with an artificial sky where the team could control the amount of light and the location of celestial bodies.
They found that the beetles see many things that humans can’t – including the spectral gradient of the sky and polarised light.
“Just using the Sun for example, if there’s a cloud, the beetle would be lost,” said Dr Basil El Jundi, from Lund University, who led the study.
“You need to add a lot of cues into the system to make it robust, and that is why they use as many celestial cues as possible.”
According to the researchers, the beetle’s dextrous dance on the smelly sphere is the key moment when the mental snapshot of the sky is taken.
“In that situation they scan the sky and take a mental image of what the sky looks like and when they start rolling they try to match the actual visual scenery of the sky with the mental image they have stored before. And that brings them away in a straight line,” said Dr El Jundi.
Ants also store mental images when they navigate but only of their natural surroundings. The beetles, uniquely, use the sky.
Dr El Jundi says that what the team have learned about the way that dung beetles process information from the sky could have implications for the human development of self-driving vehicles.
“Based on these results you could create robots or algorithms that could be incorporated into autonomous vehicles that could navigate without cues that humans input into the system,” he told BBC News.
The study has been published in the journal, Current Biology.