When mushrooms are exposed to sunlight, their compounds undergo a transformation that increases their vitamin D content. Specifically, placing mushrooms with their gills facing upward in direct sunlight for 15 to 30 minutes allows them to absorb UV light. This process helps convert their natural compounds into vitamin D2, a form of the vitamin that offers health benefits, even though it differs from the vitamin D3 produced in human skin.