When is a mushroom more than just a mushroom? When it glows. It might sound like a psychedelic riddle, but when it comes to bioluminescent mushrooms, it’s reality. The glow-in-the-dark fungi have been found in places like Brazil and Vietnam. But now, reports Rachel Becker for The Verge, have researchers described the compound that gives the mushrooms their glow—and figured out how it's made.

It’s called oxyluciferin, and it was a mystery until quite recently. Though bioluminescent mushrooms have long been studied by scientists, they weren’t sure why the fungi glowed until 2015, when a team of researchers figured out that the mushrooms use luciferins—light-emitting compounds found in other glowing animals and plants—to attract insects. The bugs then help spread their spores to sheltered places in the forest, which helps the mushroom species survive.

Luciferins give fireflies and even bioluminescent underwater creatures their glow. Paired with an enzyme and oxygen, it releases light that illuminates the fungi. But how do the mushrooms make the stuff? A new study published in the journal Science Advances has the answer.

Scientists went foraging for the glow-in-the-dark mushrooms in Brazil and Vietnam. Back in the lab, reports Becker, they crushed the mushrooms to make a slurry filled with luciferins. Then they isolated the luciferin and studied it, capturing its chemical structure and experimenting with its ability to fuel those flourescent colors.

Not only does the team now know that the mushrooms are fueled by their own kind of luciferin, but they also figured out that the enzyme that combines with the chemical to trigger light could be what they call “promiscuous.”

That means that the enzyme might be able to interact with different luciferins—and produce even more shades of that pretty glow. And that suggests that when it comes to these magical mushrooms, there’s even more to discover.