General idea works with lenses too, but on smaller optics pattern is less noticeable. On 200/2.8 full frame lens it is already barely visible, but just enough to get perfect focus (might be due to my poor cutting skills).
For 35mm focal length and 16mm aperture a filled black circle is generated as well.
For smaller lenses set "Bahtinov factor" to 50 and "Structural bar thickness" to 1mm. Mind you, for 35mm with 16mm aperture the bars will be 0.4mm thick - impossible to cut out without laser cutter or vinyl plotter.
For such small size Y-mask should be better and easier to make
source: https://www.cloudynights.com/topic/2245 ... sing-mask/
source: https://stargazerslounge.com/topic/2804 ... vs-y-mask/
It would not work with pinhole camera, as pinhole lens already has infinite depth of field and changing distance between hole and sensor only changes its focal length.