An optical filter includes a dielectric layer formed within a resonant optical cavity, with the dielectric layer having formed therein a sub-wavelength periodic structure to define, at least in part, a wavelength for transmission of light through the resonant optical cavity. The sub-wavelength periodic structure can be formed either by removing material from the dielectric layer (e.g. by etching through an electron-beam defined mask), or by altering the composition of the layer (e.g. by ion implantation). Different portions of the dielectric layer can be patterned to form one or more optical interference filter elements having different light transmission wavelengths so that the optical filter can filter incident light according to wavelength and/or polarization. For some embodiments, the optical filter can include a detector element in optical alignment with each optical interference filter element to quantify or measure the filtered light for analysis thereof. The optical filter has applications to spectrometry, colorimetry, and chemical sensing.