The function of 10% KOH in the direct examination of skin, hair, and nail scrapings is to dissolve keratin and other cellular debris, leaving behind fungal elements that can be visualized under the microscope.