Beatfield

The moiré as the difference frequency of two gratings

Abstract

Two periodic patterns laid over each other produce a third pattern that is present in neither. This companion treats that third pattern as what it is: a low-frequency term in the product of two Fourier series. Stacked transparencies multiply their transmittances; the product of two spectra contains every sum and every difference of their frequencies; and the moiré is whichever of those lands near zero frequency with enough amplitude to survive once the gratings themselves can no longer be resolved. The familiar period formulas are special cases of this, and fail exactly where a higher-order term is the visible one. The same argument, with the pixel lattice in place of the second layer, accounts for the moiré a screen forms with a pattern drawn on it. Every predicted period is checked against a Fourier transform of rendered pixels, which shares nothing with the prediction except the definition of a layer.


1. The product

1.1 Transmittance and stacking

A printed layer is described by its transmittance, the fraction of incident light it passes at each point: one for clear film, one minus the ink density on a mark. Light that passes a point of the first layer arrives at the same point of the second and is attenuated again, so two stacked layers pass

$$T(\mathbf{x}) = t_A(\mathbf{x}), t_B(\mathbf{x}).$$

This is geometric optics. It holds while the marks are much coarser than the wavelength of light, and nothing in it involves a wavelength.

1.2 The spectrum of a product

For two sinusoidal gratings the product separates immediately:

$$\cos(2\pi,\mathbf{k}_A!\cdot!\mathbf{x}),\cos(2\pi,\mathbf{k}_B!\cdot!\mathbf{x}) = \tfrac12\cos\big(2\pi(\mathbf{k}_A-\mathbf{k}_B)!\cdot!\mathbf{x}\big) + \tfrac12\cos\big(2\pi(\mathbf{k}_A+\mathbf{k}_B)!\cdot!\mathbf{x}\big).$$

The sum term is finer than either grating. The difference term is coarser, and when the two wavevectors are close it is very much coarser. An observer who cannot resolve the gratings, an eye at a distance or a lens slightly out of focus, removes both gratings and the sum, and is left with the difference.

Real marks are not sinusoids. A dark line of duty $d$ (the fraction of each period that is ink) centred on each integer phase has the series

$$t(\phi) = (1 - \kappa d) - \kappa \sum_{n \neq 0} \frac{\sin(\pi n d)}{\pi n}, e^{2\pi i n \phi},$$

with $\kappa$ the ink density. Each layer is therefore a lattice of spots in frequency space, $G = n,\mathbf{k}$ for lines and a two-dimensional reciprocal lattice for grids and dots, each spot carrying a coefficient. The product places a spot at every $G + H$, one from each layer, with the product of their coefficients. The moiré is the spot among those that lands closest to zero with appreciable amplitude.


2. The first-order moiré

2.1 Period

For line gratings of pitches $a$ and $b$ at angle $\theta$ the reciprocal vectors have lengths $1/a$ and $1/b$, and their difference has length

$$|\mathbf{k}_A - \mathbf{k}_B| = \frac{\sqrt{a^2 + b^2 - 2ab\cos\theta}}{ab}, \qquad \Lambda = \frac{ab}{\sqrt{a^2 + b^2 - 2ab\cos\theta}}.$$

At $\theta = 0$ this is the beat, $ab/|a-b|$: pitches of 14 and 15 px give 210 px, a mismatch of one part in fifteen magnified to fifteen pitches. At $a = b$ it is $a / (2\sin(\theta/2))$: identical gratings of 14 px twisted by 4 degrees give 200.6 px. The general form covers the case neither special formula does. The playground's default, pitches of 14 and 14.6 px at 4 degrees, has a period of 175.5 px, which neither formula gives.

2.2 Direction

Fringes run perpendicular to the difference vector. For two identical gratings twisted by $\theta$ the difference vector is nearly perpendicular to both reciprocal vectors, so the fringes are nearly perpendicular to the lines, at $90^\circ + \theta/2$: they bisect the obtuse angle between the two sets of lines. Measured from rendered pixels at a twist of 6 degrees, the fringes run at 92.999 degrees.

2.3 Magnification

Translating layer $B$ by $\delta$ multiplies each of its coefficients by $e^{-2\pi i H\cdot\delta}$. The moiré term $G + H$ inherits that phase, so its fringes move by $|H|,\delta / |G + H|$ along the difference vector. For the first-order moiré of parallel lines that is $\Lambda / b$ times the translation. With pitches of 10 and 11 px the factor is ten: moving $B$ by one pixel moves the fringes by ten, and the measured shift, from the change in phase of the fringe's Fourier component, is 9.985 px.

This is the principle of the vernier. A scale of ten divisions spanning nine main divisions has a pitch nine tenths of the main pitch, and its coincidence point moves ten times as fast as the vernier itself, which is why it reads to one tenth of a division. It is also the principle of moiré strain measurement, where a deformation of a specimen grating too small to see moves fringes large enough to count.


3. Higher orders

3.1 Every product of harmonics

The first-order formula knows one term. The product contains all of them, and when the pitches are near a ratio of two, $\mathbf{k}_A - 2\mathbf{k}_B$ lands near zero and $\mathbf{k}_A - \mathbf{k}_B$ does not. For pitches of 6 and 12.5 px the first-order formula gives 11.5 px, finer than the coarser grating. The moiré actually visible has a period of 150 px, from the second harmonic of $B$ against the fundamental of $A$, and that is what the pixels show: 149.9 px.

3.2 Rational ratios

Sweep the ratio of the pitches and the visible period peaks at every simple fraction: one, two, one half, three halves, two thirds. Each is a place where some pair of harmonics coincides, and each peak is narrower and fainter than the last, because the harmonics involved are weaker. At zero twist every peak is a divergence. The first-order formula shows only the one at a ratio of one.

3.3 Zeros of the duty

The coefficients $\sin(\pi n d)/(\pi n)$ vanish whenever $nd$ is an integer. At a duty of one half every even harmonic is zero, and so is every moiré that needs one. The second-order moiré of section 3.1 needs the second harmonic of $B$; at a duty of one half its measured amplitude falls to half a percent of its thin-line value. Real print softens edges and shifts these zeros, so in practice such a moiré becomes faint rather than absent.


4. What counts as visible

A moiré is a pattern much larger than the marks that make it, and the prediction needs a rule that says so. The rule used here is that a term must survive, by at least half, a Gaussian blur wide enough to hide both gratings: 0.6 of the coarser fundamental period, at which a grating's fundamental is attenuated below one part in a thousand. That puts the finest qualifying moiré at about three times the coarser pitch.

This is a definition, and near its threshold the reported moiré can change discontinuously. An early version applied the rule to the prediction but not to the measurement, and on one triangular lattice in a hundred and fifty the two then disagreed, each picking a different term near the threshold. The measurement now uses the same rule. It picks which peak to report; it never says where the peak is.

The human visual system is not a Gaussian low-pass filter. Its contrast sensitivity is band-pass, peaking around three to five cycles per degree and falling at low frequencies as well as high ones (Campbell and Robson 1968). A moiré of very large period can therefore be invisible to a person even though it survives any blur, and stepping back from a pattern can make a fine moiré appear. The playground's viewer is the idealisation, not the eye.


5. Addition

Two projectors add light rather than multiplying it. The sum of two Fourier series has only the frequencies of its terms: no sums, no differences, nothing new near zero. The bands visible in added patterns at full sharpness are a beat in the local contrast, $\cos a + \cos b = 2\cos\frac{a-b}{2}\cos\frac{a+b}{2}$, and they average to a uniform field under the same blur that reveals a true moiré. Measured, the coarse structure that survives addition is one ten-thousandth of what survives multiplication of the same two layers.

A person can nevertheless report a faint moiré from added patterns. The visual response to intensity is compressive, and a compressive response is a nonlinearity, which creates the cross terms addition lacks. For the same reason the playground blurs in linear light and encodes for the display only afterwards: blurring encoded values would put a nonlinearity between the layers and the viewer, and would manufacture a moiré from the additive case.


6. Lattices

6.1 Square grids

A grid is two orthogonal line gratings multiplied together, and its spectrum is a square lattice of spots. Two identical grids twisted by $\theta$ have two pairs of corresponding reciprocal vectors, each pair differing by $2|\mathbf{k}|\sin(\theta/2)$, and the moiré is itself a square lattice of period $a/(2\sin(\theta/2))$. Its two fringe families are equally strong, so a measurement of the strongest peak can return either; comparisons have to be made modulo the lattice's symmetry, 90 degrees for squares and 60 for triangles.

6.2 Triangular lattices and twisted bilayer graphene

Two identical triangular lattices twisted by $\theta$ form a triangular superlattice whose lattice constant, the distance between neighbouring points where the two lattices coincide, is

$$L = \frac{a}{2\sin(\theta/2)}.$$

The spacing between rows of that superlattice, which is what a Fourier measurement recovers, is $\sqrt3/2$ times as large. With carbon's lattice constant of 0.246 nm and a twist of 1.1 degrees, $L = 12.8$ nm. That is the superlattice of magic-angle graphene, in which the electronic bands become nearly flat and the material shows correlated insulating and superconducting states (Bistritzer and MacDonald 2011; Cao et al. 2018).

The playground reproduces the geometry and nothing more. The magic angle is set by the coupling between the layers and the Fermi velocity, which a model of dots has no access to. At small angles real bilayers also relax, locally rotating to enlarge the regions of favourable stacking into domains separated by narrow walls; the period survives this reconstruction, the smooth interpolation between stackings shown here does not.


7. Rings

A pattern of concentric rings has no single spectrum. Locally, though, it is a line grating whose normal points along the radius, and the moiré of two ring patterns is predicted point by point from the two local wavevectors. The fringes are the level sets of $r_A/p_A - r_B/p_B$ where the difference term is visible, and of the sum where it is: hyperbolas over most of the plane, and ellipses near the segment joining the two centres, where the two radial directions are nearly opposite and their difference is fine while their sum is coarse. This is the indicial equation of Oster, Wasserman and Zwerling (1964), and it fails within about one pitch of either centre, where the rings curve faster than they repeat.


8. The screen is a grating

8.1 Folding

A display samples on a lattice of pixels. Sampling at unit spacing identifies each frequency with its distance to the nearest whole number of cycles per pixel, so every harmonic of a pattern lands somewhere below half a cycle per pixel, and the ones that land near zero form a moiré with the screen. A single line grating of pitch 3.1 px drawn without antialiasing, with nothing stacked on it, shows a pattern of period 31 px: its third harmonic, at $3/3.1 = 0.968$ cycles per pixel, folds to $1/31$.

8.2 Area sampling

A pixel that reports the ink it covers, rather than the ink at its centre, is a box filter, and its frequency response $\mathrm{sinc}(k_x),\mathrm{sinc}(k_y)$ is zero at every whole number of cycles per pixel. Those are exactly the frequencies that fold closest to zero, so area sampling suppresses the screen moiré where it would be most visible. At $3/3.1$ cycles per pixel the response is $|\mathrm{sinc}(0.968)| = 0.033$. Measured, the folded pattern falls to 0.032 of its point-sampled amplitude; the small excess is higher harmonics folding onto the same frequency.

8.3 The pixel ratio

A high-density display draws each css pixel with several device pixels, and the fold happens on the device lattice. The same grating of 3.1 css px spans 6.2 device pixels on a display of ratio two, where the harmonic that would fold closest to zero is the sixth, which a duty of one sixth zeroes. The screen preset therefore specifies its pitch in device pixels, and the playground predicts the screen moiré for the display it is running on. On a display of ratio two the framebuffer, read back and transformed, shows the predicted 31 device pixel period at 22.7% contrast (25.5% before the analysis blur), falling by a factor of 27 under area sampling. The same folding is why a camera pointed at a screen records a moiré the eye does not see.


9. Drawing without manufacturing a moiré

A renderer that approximates how much of a pixel a mark covers commits an error that depends on where the mark falls relative to the pixel grid, and an error periodic in position is itself a moiré against the screen. The field is therefore drawn with exact coverage.

For straight marks, the projection of a square pixel onto the marks' normal is a trapezoid, the convolution of two boxes. Averaging a periodic rect over a trapezoid needs the rect's second antiderivative at four points; that antiderivative is a quadratic, which contributes exactly the duty, plus a bounded periodic part, which is evaluated directly. The result is exact and stays accurate however many periods from the origin the pixel is. For dots, the area of a disc inside a square has a closed form: the part of the disc above a horizontal line between two abscissae is an integral of chord height with an elementary antiderivative, and a rectangle is a difference of two such strips. Checked against sixty-four-fold supersampling, line coverage agrees to 1.5 parts in a thousand and dot coverage to 1.5 parts in a thousand, which is the supersampling's own resolution.

The GPU shader is a line-for-line port of the CPU model. Read back from the framebuffer at six hundred device pixels, the line field agrees with the CPU in 1797 of 1800 colour channels, the other three differing by one step of 255, and the dot field in all 1800. The blur is applied in linear light in two separable passes and encoded for the display only at the end.


10. How the model is checked

Every predicted period is compared with a measurement that ignores the prediction. The measurement renders the product of the two layers into a 512 by 512 array of pixels, subtracts the mean, applies a Hann window, takes the two-dimensional Fourier transform, weights it by the same visibility rule the prediction uses, and refines the location of the strongest peak between bins by fitting to the directly evaluated transform.

Across a hundred and fifty random pairs of lines, grids and triangular lattices, at pitch ratios near one and near two, the predicted and measured periods agree with a median difference between 0.001% and 0.03% by family and a worst case of 0.73%, and the fringe directions to within a quarter of a degree.

The calibration panel lists fourteen cases against published values:

casepredictedexpectedsource
magic-angle graphene superlattice, nm12.81413Cao et al. 2018
ten-division vernier, magnification10.00010Vernier 1631
beat of parallel lines, px110.093110Oster et al. 1964
equal pitches twisted 6 degrees, px95.55395.537Oster and Nishijima 1963
fringe direction at 6 degrees92.99993bisects the obtuse angle
pitch and angle together, px81.19081.155Amidror 2009
second-order moiré, px149.898150Amidror 2009
second-order at duty one half, relative amplitude0.0050square-wave harmonics
magnifier, px of fringe per px of layer9.98510Post, Han and Ifju 1994
square-lattice moiré, px137.131137.554reciprocal-lattice difference
triangular superlattice, px91.60691.696Bistritzer and MacDonald 2011
addition, relative amplitude0.0000no cross terms
screen moiré, px31.00031Shannon 1949
area over point sampling0.0320.033box filter at 3/3.1

All but the graphene case are measured from pixels. The graphene case compares the superlattice formula at graphene's lattice constant with the period reported for magic-angle devices, which is quoted as about 13 nm.


11. What this does not do

It has no wavelength. Gratings with pitches approaching the wavelength of light diffract, the layers interfere as waves, and self-images appear at the Talbot distance behind each one. None of that is modelled.

It does not model the eye. The viewer is a Gaussian blur, where the visual system is a band-pass filter whose effective scale changes with viewing distance.

It does not predict the magic angle. The graphene preset reproduces the superlattice geometry at 1.1 degrees; why that angle is special is a question about electrons, not geometry.

Rings are predicted locally and not near their centres, and are absent from the calibration because a pattern with no single period cannot be measured with a single transform.

The display is assumed to have square pixels. Real panels have striped subpixels and browsers at fractional scaling resample the canvas, each a further grating the playground does not control.


References

  • Oster, G., Wasserman, M. and Zwerling, C. (1964). Theoretical interpretation of moiré patterns. Journal of the Optical Society of America 54(2), 169. https://doi.org/10.1364/JOSA.54.000169
  • Oster, G. and Nishijima, Y. (1963). Moiré patterns. Scientific American 208(5), 54.
  • Amidror, I. (2009). The Theory of the Moiré Phenomenon, Volume I: Periodic Layers, 2nd edition. Springer.
  • Post, D., Han, B. and Ifju, P. (1994). High Sensitivity Moiré: Experimental Analysis for Mechanics and Materials. Springer.
  • Vernier, P. (1631). La construction, l'usage, et les propriétés du quadrant nouveau de mathématiques. Brussels.
  • Shannon, C. E. (1949). Communication in the presence of noise. Proceedings of the IRE 37(1), 10.
  • Campbell, F. W. and Robson, J. G. (1968). Application of Fourier analysis to the visibility of gratings. Journal of Physiology 197(3), 551.
  • Bistritzer, R. and MacDonald, A. H. (2011). Moiré bands in twisted double-layer graphene. PNAS 108(30), 12233. https://doi.org/10.1073/pnas.1108174108
  • Cao, Y., Fatemi, V., Fang, S., Watanabe, K., Taniguchi, T., Kaxiras, E. and Jarillo-Herrero, P. (2018). Unconventional superconductivity in magic-angle graphene superlattices. Nature 556, 43. https://doi.org/10.1038/nature26160
  • Moiré pattern. https://en.wikipedia.org/wiki/Moir%C3%A9_pattern