Diffuser
Spreads incident light into a configurable angular fan.
Open in the canvas →In the real world
An optical diffuser scatters a beam into a cone of directions by refracting light through a microscopically rough or engineered surface — ground or frosted glass, a holographic diffuser with an embossed random microstructure, or an engineered "top-hat" diffuser designed for a specific divergence angle and intensity profile. Each microscopic facet still obeys ordinary Snell's law; what differs from a diffuser to a plain glass window is only the local surface normal, which varies randomly (or by design) from point to point at a scale far smaller than the beam.
Diffusers homogenize illumination and convert a laser's narrow beam into broad, uniform lighting — and, critically for coherent sources, reduce speckle. A static diffuser illuminated by coherent laser light produces a grainy interference pattern (speckle) from the random path-length differences between scattered wavelets; spinning the diffuser fast enough that its pattern changes within a camera's or eye's integration time averages that speckle out into smooth illumination.
In OpticalSetup
Each incident ray is split into a small fan of rays (five, for a single traced ray), scattered within the configured divergence half-angle around the original direction. The scatter angle for each ray isn't randomized frame to frame — it's a deterministic pseudo-random offset computed from the surface's own ID, so the same diffuser always produces the exact same fan on every render, which is what keeps the speckled pattern stable and inspectable rather than flickering as you pan or re-render the sketch.
Divergence is set directly as a configured half-angle rather than derived from any surface-roughness or microstructure spec, and the scattered directions are a small fixed-count sample (five rays for a single incident ray) rather than a continuous or wavelength-dependent angular distribution — there's no Gaussian or top-hat irradiance profile actually computed, just a jittered fan. The speckled look is a fixed, deterministic pattern with no real interference behind it: unlike true laser speckle, it never changes with viewing angle, beam position, or a spinning diffuser, since no coherence or interference is modeled anywhere in the app.