There are many ways to prevent stray light in an optical system. Five of the most common are: Baffles, absorptive filters, dichroic filters, black paint, and smaller apertures.