<p>The movement of the diffraction spikes is similar to the phase detection autofocus that's been used in SLR cameras for decades. Before the days of autofocus, many SLR cameras had a split-image viewfinder that used the same principle as well<sup>1</sup>.</p>
<p>To keep things simple, let's consider a mask with just two slits out at the very edge of the aperture.</p>
<p><a href="https://i.sstatic.net/O0Xxv.png" rel="noreferrer"><img src="https://i.sstatic.net/O0Xxv.png" alt="enter image description here" /></a></p>
<p>Now let's consider what that does as we're focusing. I'm going to draw things in terms of a refractor, but using a reflector doesn't really change things. So, here's a simplified (and drastically <em>not</em> to scale) diagram of light coming from a star, going through the two slits above, and coming into focus on a plane behind the lens:</p>
<p><a href="https://i.sstatic.net/Thcys.png" rel="noreferrer"><img src="https://i.sstatic.net/Thcys.png" alt="enter image description here" /></a></p>
<p>So, we have a star on the left, two rays of light leaving the star and traveling to the two slits, going through the slits, being refracted by the lens, and coming into focus on the plane. The image is in focus when the two rays of light come back together precisely at the surface of that plane. So what we see when we look at this should be basically a single line. We really have two diffraction spikes, one from each slit, but since we've brought it into perfect focus, they'll line up with each other perfectly. So, in simplified (and hand drawn) form, what we see looking at this, is a picture like this:</p>
<p><a href="https://i.sstatic.net/orsMF.png" rel="noreferrer"><img src="https://i.sstatic.net/orsMF.png" alt="enter image description here" /></a></p>
<p>Two diffraction spikes, but they align perfectly with each other. I've drawn a boundary between the two, but in real viewing, there won't be an obvious boundary at the edge of each diffraction spike--we'll just see basically a single line.</p>
<p>So let's consider what happens when we move that plane, so the image is out of focus. The rays of light continue to be refracted to exactly the same degree, so we end up with something like this:</p>
<p><a href="https://i.sstatic.net/OlFtN.png" rel="noreferrer"><img src="https://i.sstatic.net/OlFtN.png" alt="enter image description here" /></a></p>
<p>In this case, we can see that the two aren't hitting the focus plane at the same point, so what we'll see will be two mis-aligned diffraction spikes:</p>
<p><a href="https://i.sstatic.net/iLPxT.png" rel="noreferrer"><img src="https://i.sstatic.net/iLPxT.png" alt="enter image description here" /></a></p>
<p>That explains how (some of) the spikes appear to move as we focus. That leaves another obvious question: how do we get the other spikes that <em>don't</em> move as we focus? That's actually pretty simple. If you look back at the first picture above, there's a crucial fact to note. The slits are (at least approximately) tangent to the aperture.</p>
<p>To form the X-shaped diffraction spikes, the Bahtinov mask uses slits that are radial instead. Technically, these do still move (a little) but it involves the diffraction spike moving along its length instead of sideways, so it's much less visible even at best. There's also little or nothing at the end of each diffraction spike, so you don't have much to compare against to see the movement.</p>
<p>Beyond that, it's all &quot;user interface&quot; enhancements to make it easier to use: More slits, carefully aligned with each other, project diffraction spikes on top of each other, so you get what looks like a single diffraction spike that's a lot brighter. The X-shape guides you eye toward the place you should be looking to see whether the spikes are properly aligned, and so on.</p>
<p>Now don't get me wrong: those are important, and definitely part of the genius of the design--but the basic principle of how/why the spikes appear to move relative to each other remains the same (and why some move but others don't appear to).</p>
<hr />
<sup>
1. Note that many rangefinder cameras also used split-image focusing, but it worked rather differently--what I'm talking about here is strictly the version used with SLRs. An SLR with a split-image viewfinder used the same principle as shown here. The difference is that instead of using an aperture with slits, it used a pair of prisms at the center of the viewfinder to collect light from near the edges of the lens. But it still used the basic idea of collecting light from two opposite edges of the aperture, and showing them next to each other, and your focusing by aligning the pictures showing from each. It didn't use diffraction spikes, because in normal photography you typically have objects in the picture with obvious lines in them. Diffraction spikes just let us take subject matter that's mostly just dots, and creating lines from them.
</sup>

CC BY-SA 4.0
2020-08-14T09:30:20.943Z
I approve of the diagrams, however it should be noted that they are not *quite* accurate: any pair of parallel slits should produce a single symmetric diffraction peak from any point source (i.e. a star).
William Miller
CC BY-SA 4.0
2020-08-13T15:49:44.833Z
2020-08-13T17:42:38.930Z
2020-08-13T17:42:38.930Z
Jerry Coffin
<p>Diagram from the <a href="https://en.wikipedia.org/wiki/Bahtinov_mask" rel="nofollow noreferrer">Wikipedia page</a>:</p>
<img src="https://i.sstatic.net/vIKI2.png" width="300"/>
<p>The different sections of the mask create different diffraction spikes by using the slits to create interference based on the <a href="https://en.wikipedia.org/wiki/Huygens%E2%80%93Fresnel_principle" rel="nofollow noreferrer">Huygens-Fresnel principle</a>. The different sections create the misaligned spikes due to their radial orientation.</p>
<p>When the instrument is out of focus (either ahead or behind the focus point) the centers of the interference patterns are not aligned: when the primary lens or mirror is closer to the mask than the focus point the 'X' will be either to the left or right of the '|' (depending on the orientation and flipping caused by the rest of the optical train), and when the primary is further from the mask than the focus point the opposite will be true.</p>
<p>So, in to answer the question of 'why do the spikes move?' - as the distance from the primary element to the mask changes, the place where the rays from the diffraction peaks are intersected changes accordingly.</p>
<p>In theory you could achieve a similar effect with only two sections of slits with different radial alignments, but this would make it more difficult to precisely find the aligned point because it would only produce two spikes.</p>

CC BY-SA 4.0
2020-08-14T02:23:47.357Z
2020-08-14T07:23:01.363Z
2020-08-14T07:23:01.363Z
William Miller
<p>The question <a href="https://astronomy.stackexchange.com/q/36867">Lucky imaging with Celestron 14 - is this result reasonable?</a> includes a beautiful example of a focus test using a <a href="https://en.wikipedia.org/wiki/Bahtinov_mask" rel="nofollow noreferrer">Bahtinov mask</a> and the image below from Deep Sky Watch's <a href="http://www.deepskywatch.com/Articles/make-bahtinov-mask.html" rel="nofollow noreferrer">Home Made Bahtinov Focusing Mask &amp; Templates</a> shows how the middle spike moves left-right with respect to the crossing point of the pair of spikes on either side.</p>
<p><strong>Question:</strong> But optically speaking how and why does this happen? What is it about the layout of the three gratings in a Bahtinov mask that makes its indicate focus in this way? Why exactly does changing focus produce a lateral shift of one pattern with respect to the other two? What is it about the mask's peculiar design that makes this happen the way it does?</p>
<p><strong>update:</strong> <a href="https://astronomy.stackexchange.com/a/949">This answer</a> to <em>How does a Bahtinov mask work?</em> explains more what happens, but it does not even begin to address <em>Why exactly...</em></p>
<p><a href="https://i.sstatic.net/8QU9y.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/8QU9y.jpg" alt="triple diffraction pattern from Deep Sky Watch's Home Made Bahtinov Focusing Mask &amp; Templates" /></a> <a href="http://www.deepskywatch.com/Articles/make-bahtinov-mask.html" rel="nofollow noreferrer">Source</a></p>
<blockquote>
<p>Star image produced by Bahtinov focusing mask at different focus positions</p>
</blockquote>

CC BY-SA 4.0
2020-08-13T10:20:34.177Z
@a_donda the goal of (almost all of) my SE questions is to provide a space and opportunity for answer-posting. If you think you know of an explanation that at least some readers will find satisfying, then consider posting a short answer with a quote and link? (fyi I've added a link to that other question, thanks for mentioning it!)
uhoh
CC BY-SA 4.0
2020-08-13T10:50:09.320Z
@a_donda no I don't think it does. "... representing the transform of the mask pattern's spatial frequency and orientation." is hardly an explanation of why this happens. There is something very specific in the layout of this particular pattern, if you divide up the aperture into three gratings differently, it may not work.
uhoh
CC BY-SA 4.0
2020-08-13T10:59:41.107Z
@a_donda I've edited the title and copied that into the body as well.
uhoh
CC BY-SA 4.0
2020-08-13T15:08:16.357Z
Possibly useful analogy:  SLR cameras with split-prism focussing element.  In each case, you're at focus when two offset "tweaking elements" line up.
Carl Witthoft
CC BY-SA 4.0
2020-08-13T20:30:39.290Z
@a_donda: With a split-image viewfinder, the image isn't projected onto matte glass. The split-image part was typically *surrounded* by ground glass, with the image projected onto it, but the prisms for the split image were ground into the surface of the focusing screen. The light/dark half was basically accidental, from your eye being off-center, so you only saw the light coming from one prism (especially common with relatively slow lenses, where the prisms were pointed at the very edge of the lens aperture).
Jerry Coffin
<observational-astronomy><telescope><amateur-observing><optics>
What is it about the layout of the three gratings in a Bahtinov mask that makes its indicate focus in this way?
uhoh
# What is it about the layout of the three gratings in a Bahtinov mask that makes its indicate focus in this way?

(Asked by: username_0 on 2020-08-13)

The question [Lucky imaging with Celestron 14 - is this result reasonable?](https://astronomy.stackexchange.com/q/36867) includes a beautiful example of a focus test using a [Bahtinov mask](https://en.wikipedia.org/wiki/Bahtinov_mask) and the image below from Deep Sky Watch's [Home Made Bahtinov Focusing Mask & Templates](http://www.deepskywatch.com/Articles/make-bahtinov-mask.html) shows how the middle spike moves left-right with respect to the crossing point of the pair of spikes on either side.

**Question:** But optically speaking how and why does this happen? What is it about the layout of the three gratings in a Bahtinov mask that makes its indicate focus in this way? Why exactly does changing focus produce a lateral shift of one pattern with respect to the other two? What is it about the mask's peculiar design that makes this happen the way it does?

**update:** [This answer](https://astronomy.stackexchange.com/a/949) to *How does a Bahtinov mask work?* explains more what happens, but it does not even begin to address *Why exactly...*

[![triple diffraction pattern from Deep Sky Watch's Home Made Bahtinov Focusing Mask & Templates](https://i.sstatic.net/8QU9y.jpg)](https://i.sstatic.net/8QU9y.jpg) [Source](http://www.deepskywatch.com/Articles/make-bahtinov-mask.html)

> Star image produced by Bahtinov focusing mask at different focus positions

**Tags:** observational-astronomy, telescope, amateur-observing, optics

> **Comments:**
> **username_0**: @a_donda the goal of (almost all of) my SE questions is to provide a space and opportunity for answer-posting. If you think you know of an explanation that at least some readers will find satisfying, then consider posting a short answer with a quote and link? (fyi I've added a link to that other question, thanks for mentioning it!)  
> **username_0**: @a_donda no I don't think it does. "... representing the transform of the mask pattern's spatial frequency and orientation." is hardly an explanation of why this happens. There is something very specific in the layout of this particular pattern, if you divide up the aperture into three gratings differently, it may not work.  
> **username_0**: @a_donda I've edited the title and copied that into the body as well.  
> **username_1**: Possibly useful analogy:  SLR cameras with split-prism focussing element.  In each case, you're at focus when two offset "tweaking elements" line up.  
> **username_2**: @a_donda: With a split-image viewfinder, the image isn't projected onto matte glass. The split-image part was typically *surrounded* by ground glass, with the image projected onto it, but the prisms for the split image were ground into the surface of the focusing screen. The light/dark half was basically accidental, from your eye being off-center, so you only saw the light coming from one prism (especially common with relatively slow lenses, where the prisms were pointed at the very edge of the lens aperture).  

---

## 2 answers

### Answer by username_2 on 2020-08-13. Score: 7

The movement of the diffraction spikes is similar to the phase detection autofocus that's been used in SLR cameras for decades. Before the days of autofocus, many SLR cameras had a split-image viewfinder that used the same principle as well1.

To keep things simple, let's consider a mask with just two slits out at the very edge of the aperture.

[![enter image description here](https://i.sstatic.net/O0Xxv.png)](https://i.sstatic.net/O0Xxv.png)

Now let's consider what that does as we're focusing. I'm going to draw things in terms of a refractor, but using a reflector doesn't really change things. So, here's a simplified (and drastically *not* to scale) diagram of light coming from a star, going through the two slits above, and coming into focus on a plane behind the lens:

[![enter image description here](https://i.sstatic.net/Thcys.png)](https://i.sstatic.net/Thcys.png)

So, we have a star on the left, two rays of light leaving the star and traveling to the two slits, going through the slits, being refracted by the lens, and coming into focus on the plane. The image is in focus when the two rays of light come back together precisely at the surface of that plane. So what we see when we look at this should be basically a single line. We really have two diffraction spikes, one from each slit, but since we've brought it into perfect focus, they'll line up with each other perfectly. So, in simplified (and hand drawn) form, what we see looking at this, is a picture like this:

[![enter image description here](https://i.sstatic.net/orsMF.png)](https://i.sstatic.net/orsMF.png)

Two diffraction spikes, but they align perfectly with each other. I've drawn a boundary between the two, but in real viewing, there won't be an obvious boundary at the edge of each diffraction spike--we'll just see basically a single line.

So let's consider what happens when we move that plane, so the image is out of focus. The rays of light continue to be refracted to exactly the same degree, so we end up with something like this:

[![enter image description here](https://i.sstatic.net/OlFtN.png)](https://i.sstatic.net/OlFtN.png)

In this case, we can see that the two aren't hitting the focus plane at the same point, so what we'll see will be two mis-aligned diffraction spikes:

[![enter image description here](https://i.sstatic.net/iLPxT.png)](https://i.sstatic.net/iLPxT.png)

That explains how (some of) the spikes appear to move as we focus. That leaves another obvious question: how do we get the other spikes that *don't* move as we focus? That's actually pretty simple. If you look back at the first picture above, there's a crucial fact to note. The slits are (at least approximately) tangent to the aperture.

To form the X-shaped diffraction spikes, the Bahtinov mask uses slits that are radial instead. Technically, these do still move (a little) but it involves the diffraction spike moving along its length instead of sideways, so it's much less visible even at best. There's also little or nothing at the end of each diffraction spike, so you don't have much to compare against to see the movement.

Beyond that, it's all "user interface" enhancements to make it easier to use: More slits, carefully aligned with each other, project diffraction spikes on top of each other, so you get what looks like a single diffraction spike that's a lot brighter. The X-shape guides you eye toward the place you should be looking to see whether the spikes are properly aligned, and so on.

Now don't get me wrong: those are important, and definitely part of the genius of the design--but the basic principle of how/why the spikes appear to move relative to each other remains the same (and why some move but others don't appear to).

---

1. Note that many rangefinder cameras also used split-image focusing, but it worked rather differently--what I'm talking about here is strictly the version used with SLRs. An SLR with a split-image viewfinder used the same principle as shown here. The difference is that instead of using an aperture with slits, it used a pair of prisms at the center of the viewfinder to collect light from near the edges of the lens. But it still used the basic idea of collecting light from two opposite edges of the aperture, and showing them next to each other, and your focusing by aligning the pictures showing from each. It didn't use diffraction spikes, because in normal photography you typically have objects in the picture with obvious lines in them. Diffraction spikes just let us take subject matter that's mostly just dots, and creating lines from them.

> **Comments:**
> **username_3**: I approve of the diagrams, however it should be noted that they are not *quite* accurate: any pair of parallel slits should produce a single symmetric diffraction peak from any point source (i.e. a star).  

---

### Answer by username_3 on 2020-08-14. Score: 5

Diagram from the [Wikipedia page](https://en.wikipedia.org/wiki/Bahtinov_mask):

![](https://i.sstatic.net/vIKI2.png)

The different sections of the mask create different diffraction spikes by using the slits to create interference based on the [Huygens-Fresnel principle](https://en.wikipedia.org/wiki/Huygens%E2%80%93Fresnel_principle). The different sections create the misaligned spikes due to their radial orientation.

When the instrument is out of focus (either ahead or behind the focus point) the centers of the interference patterns are not aligned: when the primary lens or mirror is closer to the mask than the focus point the 'X' will be either to the left or right of the '|' (depending on the orientation and flipping caused by the rest of the optical train), and when the primary is further from the mask than the focus point the opposite will be true.

So, in to answer the question of 'why do the spikes move?' - as the distance from the primary element to the mask changes, the place where the rays from the diffraction peaks are intersected changes accordingly.

In theory you could achieve a similar effect with only two sections of slits with different radial alignments, but this would make it more difficult to precisely find the aligned point because it would only produce two spikes.


---

