A programmable spatial filter for use as a Fourier plane filter in dark field wafer inspection systems, based on the use of MEMS (Micro-Electro-Mechanical Systems) devices. In comparison with prior art systems, especially those using LCD's, the use of MEMS devices provide a number of potential advantages, including good transmission in the UV, a high fill factor, polarization independence and a high extinction ratio since the shutter is opaque when closed. The MEMS devices can be flap devices, artificial eyelid, or double shutter devices. Additionally, a novel spatial light modulator (SLM) assembly having a double layer of SLM arrays is described, in which the fill factor is increased in comparison to a single layer SLM using the same devices, by positioning the dead areas of the elements of both arrays collinearly in the modulated beam. This SLM assembly can be implemented using pixelated LCD arrays or MEMS arrays.