Astrophotography Focus Mask

The Bahtinov mask is a device used to focus small astronomical telescopes accurately. It was invented by Russian amateur astrophotographer Pavel Bahtinov in 2005. The telescope (or camera) is pointed at a bright star, and a mask is placed in front of the telescope’s objective (e.g. primary mirror) or the camera lens. You can generate one from Astrojargon 

Simulation_of_a_bahtinov_mask_diffraction_pattern_when_focusing.gif

Simulation of a bahtinov mask diffraction pattern when focusing

The mask consists of three separate grids, positioned in such a way that the grids produce three angled diffraction spikes at the focal plane of the instrument for each bright image element. As the instrument’s focus is changed, the central spike appears to move from one side of the star to the other. In reality, all three spikes move, but the central spike moves in the opposite direction to the two spikes forming the “X”. Optimal focus is achieved when the middle spike is centered between the other two spikes. 

From Wikipedia