Skyglow — the artificial brightening of the night sky — falls off with distance from a light source far faster than a simple inverse-square law, because scattered light spreads through the atmosphere. This simulator uses Walker's Law (Walker, 1977), an empirical relation confirmed across hundreds of cities, for the artificial sky-brightness contribution at the zenith:
B_art / B_natural ≈ k · P / d^2.5
P = city population (light output proxy)
d = distance from city centre, km
k = clarity constant (haze raises it, dry clear air lowers it)
Total sky brightness combines the natural airglow baseline (≈21.9 mag/arcsec² at a pristine zenith) with the artificial contribution on a logarithmic magnitude scale:
m_sky = 21.9 − 2.5·log₁₀(1 + B_art/B_natural)
Naked-eye limiting magnitude then follows the sky brightness (steeper sky glow buries fainter stars in glare), and the star field is a synthetic catalogue of 2,800 stars whose magnitudes follow the real stellar luminosity function (roughly 2.5× more stars per magnitude step) — only stars brighter than the current limiting magnitude are rendered visible.
- Population — bigger cities dump proportionally more lumens skyward through unshielded fixtures, roof glow and vehicle headlights.
- Distance — the single biggest lever for a stargazer: the d^2.5 falloff means driving 10× farther from a city cuts its glow contribution by roughly 300×.
- Atmospheric clarity — haze, humidity and aerosols scatter city light sideways and upward, amplifying skyglow at any fixed distance; dry, clean high-altitude air suppresses it.
- Bortle scale — the standard 1 (pristine) to 9 (inner-city) naked-eye sky-darkness scale, derived here from the computed sky brightness.
Real-world relevance: this is the same class of model light-pollution researchers and dark-sky park planners use to draw the buffer distance a new observatory or nature reserve needs from the nearest city, and it is the physical basis for why International Dark Sky Places are sited far from major population centres.