The Sun: Solar Flares; Gamma Rays; VITAMIN D?

I love the dichotomy that is the Sun. Giver of life and an abundance of energy, yet, a dangerous entity capable of untold horrors. Ok, I’m being a little dramatic, but just how is it we humans get Vitamin D from this infernal ball? I was under the impression Vitamins were elemental nutrients our bodies needed from external sources… mainly from the stuff we eat. How is it we can obtain Vitamin D from radiation? Obviously there is a flaw in my understanding; I’d just like to know where.

Our bodies synthesize vitaman D from elements already present. I’m not sure if sunlight directly provides the energy to do so as in plant photosynthysis or if it just provides stimulation for the body to do so. Having all the elements in a compound is not the same as having the compound.

Vitamin D isn’t really a vitamin, it’s a steroid hormone precursor that has the following forms:

D[sub]1[/sub] - Lamisterol
D[sub]2[/sub] - Ergocalciferol
D[sub]3[/sub] - Cholecalciferol
D[sub]4[/sub] - Dihydrotachysterol
D[sub]5[/sub] - Dehydrositosterol

It’s D[sub]3[/sub] that is synthesized from cholesterol with the aid of ultraviolet light from the sun.

So, UV light is the catalyst that allows these compounds to form D[sub]3[/sub]? I kinda feel silly, because upon further considering after I posted the question, I figured it might be a synthesis kind of scenario.

Thanks for the answers!