Melanocytes produce melanin through a process called melanogenesis. This involves the enzyme tyrosinase, which catalyzes the conversion of the amino acid tyrosine into melanin. Melanin is then transferred to surrounding keratinocytes through specialized organelles called melanosomes. This pigment absorbs and dissipates UV radiation, protecting the DNA in skin cells from damage.