About the physics

Every scene is computed, not painted. This summarises the models, where they come from, and how they were checked.

Sky light

Scattering is integrated through a spherical atmosphere in six spectral bands (440–650 nm), converted to colour with the CIE 1931 colour-matching functions. Rayleigh scattering has a vertical optical depth of 0.097 at 550 nm (Bucholtz 1995), aerosol uses a Cornette–Shanks phase function, and ozone uses Chappuis-band absorption (column 0.044 at 600 nm). Single scattering is exact; higher orders use a multiple-scattering table after Hillaire (2020). Checked: the sky's brightness pattern matches the CIE Standard General Sky clear types 12 and 13 (ISO 15469) to 18–29% rms with typical haze. The Belt of Venus layering matches a photograph to within about 1° in elevation.

Ice halos

A Monte Carlo ray tracer follows millions of rays through hexagonal ice prisms with Fresnel reflection and refraction at every face, at 16 wavelengths, using measured ice dispersion (Warren & Brandt 2008). Crystal shapes and orientations are adjustable: random, plate, column, Parry and Lowitz. Checked: 22° and 46° minimum deviations 21.8° and 45.6°; sun dogs within 0.6° of the Bravais-index prediction from 0° to 50° Sun elevation; circumzenithal arc within 0.3°; sun-pillar length matched to a photograph.

Rainbows

Large drops use Airy theory with argument (D − DR)(x²/α)1/3 (Berry 2001), normalised to the Fresnel cross-section and blended into exact geometric optics away from the bow. Fog and cloud droplets up to 30 µm use exact Mie theory. All bows are averaged over drop sizes and the 0.53° solar disk. Checked: supernumerary spacing within 3% of the analytic Airy values; exact Mie and Airy theory place the bow within 0.15° of each other for 60–150 µm drops (their peak brightness differs by 4–15%, partly from the fine ripple of single-size Mie results); at 30 µm Airy theory is 0.4° off, which is why exact Mie is used for drops of 30 µm and smaller; Alexander's band is the darkest region; fogbow matched to a photograph.

Coronas, glories and the Tyndall effect

Exact Mie theory (Bohren & Huffman series) for water droplets and for colloidal particles, averaged over a size distribution. Checked: it reproduces the Rayleigh limit and a published efficiency (m = 1.5, x = 1: 0.2151). Glory ring ratios 1.87 and 0.53 against 1.81 and 0.56 in a photograph.

Heiligenschein

Dry ground uses Hapke's shadow-hiding law. Dew uses a Monte Carlo ray trace of water drops resting on randomly tilted grass blades.

Refraction and mirages

Rays are integrated row by row through a hydrostatic standard atmosphere with adjustable inversions and Earth curvature, in three colour channels using Edlén dispersion. Checked: astronomical refraction within 0.3% of the exact Oriani–Laplace series above 20° altitude, and 1–3.5% below Bennett's empirical formula from 0° to 60° (Bennett runs about 3% high even where the series is exact, a refractivity difference in its underlying tables); superior and inferior mirage geometry matched to photographs.

Lunar eclipse and noctilucent clouds

The eclipsed Moon is lit by sunlight refracted through Earth's limb. Each grazing ray is bent by N(h)√(2πR/H), dimmed by the full chord's Rayleigh, aerosol and ozone columns in six bands, and focused by ring-area conservation; the profile is then convolved with the limb-darkened solar disk. Checked: umbra radius 4,583 km (2.64 Moon radii) and penumbra 8,159 km at the Moon, within 0.4% of the similar-triangles values (4,599 and 8,176 km; the small difference is the Sun's parallax, which the model omits). Noctilucent clouds at 83 km are lit along their own grazing paths, so their blue comes from ozone absorption.

Zodiacal light, Bishop's ring and blue Sun

Zodiacal light and the gegenschein use the published brightness map of Leinert et al. (1998), Table 16 (S10 units at 500 nm), interpolated in helioecliptic coordinates and dimmed by atmospheric extinction. Bishop's ring and the blue Sun use exact Mie theory for droplets of refractive index 1.45: particles of 0.45–0.6 µm extinguish red more strongly than blue (by up to 1.9×), which is what turns the disk blue.

Coronas and diffraction theory

Coronas use exact Mie theory, not the Fraunhofer diffraction formula. The two agree for large droplets (first dark ring within 0.2% at 40 µm), but for small droplets Mie puts the rings inside the diffraction-theory radii, by about 3% at 20 µm, 6% at 10 µm and 8% at 5 µm, because light refracted through the droplet interferes with the diffracted light.

Self-checks

Runs the app's own physics code in your browser and compares each result with a published value or an independent analytic result: the Mie solvers, the ice-halo ray tracer, the refraction integrator, the eclipse geometry, the colour pipeline and the zodiacal-light table. Takes a few seconds.

The sky of Mars

Exact Mie theory for absorbing spheres (complex refractive index; validated against Bohren & Huffman's reference case to all published digits, and against the small-particle absorption limit). Dust: log-normal, effective radius 1.6 µm (Tomasko et al. 1999), n = 1.50, imaginary index rising steeply below 670 nm between published anchors (0.001 at long wavelengths, Wolff et al. 2009; 0.01 at 305 nm, Mariner 9), giving single-scattering albedo 0.85 at 440 nm and 0.97 at 650 nm. CO₂ Rayleigh optical depth 0.0025 at 550 nm. Spherical shell of radius 3389.5 km, scale height 11.1 km. Single scattering is exact with the full phase function; multiple scattering follows Hillaire (2020) using the true phase function for the first bounce and delta-M truncation of the diffraction peak. The blue sunset emerges from the model: the sky is bluer than sunlight within about 5° of the Sun (440/650 nm ratio 1.9 at 2°) and tan elsewhere (0.5–0.8). Real dust grains are irregular, not spherical; that mainly affects side and back scattering.

GPU rendering (WebGL2)

With the GPU button on, the sky, rainbow and ice-halo scenes run on the graphics card at about 2.4 times the pixel count. Rainbows use the same Airy and Mie tables the CPU builds, uploaded as a texture, and the same shading steps. The sky shader reads the same multiple-scattering table the CPU builds and reproduces the CPU's integer noise hash bit for bit, so clouds, mountains and noctilucent clouds have identical shapes. The halo shader traces the same hexagonal-crystal Monte Carlo, one ray per point, summed by additive blending into a 32-bit float image and normalised by the mean crystal cross-section. Shaders work in kilometres so ray–sphere tests at Earth scale keep precision in 32-bit floats. Checked against the CPU at identical views: sky scenes differ by 0.3–2.5 of 255 levels on average, rainbow scenes by 0.5–0.9, and halo brightness agrees within 1%. Scenes without a GPU version, devices without WebGL2 or float render targets, and a lost graphics context all fall back to the CPU automatically. When the browser reports a software renderer (SwiftShader, llvmpipe), the GPU starts off: software rendering is no faster than the CPU path, and under sustained load it proved unstable in testing. The button can still turn it on.

Night sky and electrical phenomena

Emission colours come from their spectra: [O I] 557.7 and 630.0 nm; N₂ and N₂⁺ bands; STEVE's continuum plus 630 nm (Gillies et al. 2019). Star colours are blackbody temperatures. Airglow uses the van Rhijn law. Heights of aurora, airglow, sprites, ELVES and STEVE come from published triangulation. Lightning channels and sprite streamers are grown with the dielectric breakdown model (Niemeyer, Pietronero & Wiesmann 1984; fractal dimension about 1.2, within the 1.1–1.4 measured from photographs). Aurora curtains follow the geomagnetic field (adjustable dip, default 77°), so an overhead corona converges on the magnetic zenith; their fold and ray scales follow observations, but their motion is illustrative. Earthquake lights are illustrative only, since their mechanism is unknown.

Tone mapping imitates a camera with automatic exposure; Photo look adds the cooler white balance and contrast typical of processed photographs.