Diffraction grating
Creates selected diffraction orders using the grating equation.
Open in the canvas →In the real world
A diffraction grating is a surface ruled with closely, evenly spaced lines (period d). Light diffracting from it interferes constructively only at angles satisfying the grating equation:
Because the equation depends on λ, each nonzero order spreads white light into a spectrum — the same effect a prism produces through dispersion, but from interference rather than refractive-index variation.
In OpticalSetup
This is one of the few components where OpticalSetup implements the textbook formula directly and exactly, solving the grating equation per sampled wavelength for every configured diffraction order, in either reflective or transmissive mode. Orders where the equation has no real solution (|sinθₘ| > 1) are simply dropped, matching a real grating's behavior of only lighting up the orders that geometrically exist.
Diffraction efficiency is split evenly across the configured orders rather than computed from the groove profile (a real blazed grating concentrates most of the light into one order by design) — order existence and angle are exact, relative brightness between orders is not.