Nayan Sukhadiya
  • Space & Aerospace
  • space
  • physics
  • threejs

Where the Sun Never Sets: Computing Sunlight at the Moon's South Pole in a Browser

At the Moon's south pole a crater rim 50 km away decides if a lander has power. How SouthWatch computes it live in a browser.

Space & Aerospace5 min read348readers

Nayan Sukhadiya

Full Stack Engineer

Published

Updated at

Every country going back to the Moon is aiming for the same small region: the south pole. It has water ice in craters that never see the Sun, and ridges that see the Sun almost all the time. For NASA Space Apps Challenge 2026 I'm building SouthWatch, under my Aetrova brand, to answer a planner's question about any spot there: when is there sunlight, when can it talk to Earth, and how sure are we?

My rule for the whole project: 5% real accuracy beats 100% fake accuracy.

The short answer

  • At the pole, terrain decides sunlight, not latitude. The Moon's axis is tilted only about 1.5°, so the Sun circles along the horizon and any ridge can block it.
  • Precompute the horizon, compute the sky live. Offline, the terrain around each site becomes a horizon mask: the angle of the skyline in every direction. In the browser, the Sun's and Earth's positions are computed for any moment and compared against that skyline.
  • Every number is labelled MEASURED, COMPUTED or MODELED, so nobody mistakes an estimate for a measurement.
The one idea behind it all The expensive part (the terrain) never changes, and the cheap part (where the Sun is) changes every second. Split the work along that line and a laptop can answer in one frame.

1. Why the pole is different

At the Moon's equator the Sun rises high, so a site gets about 14 days of light and 14 of night, like clockwork. Chandrayaan-3 landed near 69°S, close enough to the pole to be special but far enough to keep that rhythm, and it was designed for exactly one lunar day.

At the pole itself the Sun never climbs more than a degree or two. A spot on a high ridge can be lit for most of the year; a crater floor a few kilometres away can stay dark for billions of years. Latitude alone tells you almost nothing.

2. The horizon mask

For one site, the horizon mask is a list: for each compass direction, how high the skyline rises. Build it by marching outward over the terrain and keeping the steepest angle you meet. The Moon is small, so its curvature matters:

text
θh(A) = max over distance d of  atan( (h(A,d) − h0 − hs) / d  −  d / 2R )

h0 is the site's height, hs the sensor height (a solar panel or antenna mast), R the Moon's radius (1,737.4 km). Drop the d / 2R term and distant peaks look taller than they are, inventing shadows that don't exist.

Two numbers set the resolution:

  • The Sun is 0.53° wide, so the mask has to be finer than that. SouthWatch samples it every 0.25°, 1,440 directions per site.
  • Distant mountains count. A 5 km massif is visible from about 132 km away on a body this small (d ≈ √(2·R·h)), so the march has to reach far beyond the site's neighbourhood.

The terrain comes from NASA's Lunar Orbiter Laser Altimeter (LOLA). The raw elevation files are gigabytes, so an offline Python pipeline turns them into small binary heightmaps; today SouthWatch ships LOLA terrain at 80 m per pixel around the pole and 120 m to 60°S.

3. Where is the Sun, right now, from this crater?

In the browser, astronomy-engine gives the positions of the Sun, Earth and Moon for any instant. A short chain of rotations turns them into what an observer standing at the site would see:

  1. The Sun's position relative to the Moon.
  2. Rotated into the Moon-fixed frame (the Moon's pole direction and spin).
  3. Projected onto the site's local east, north and up.
  4. Read off as elevation and azimuth, then compared with the horizon mask in that direction.
text
lit  ⇔  sun elevation  >  θh(sun azimuth)

That comparison runs every frame, so dragging the time slider moves the light across the terrain instantly. Year-long sweeps (what percentage of 2026 is this site lit?) run in a Web Worker so the interface never stutters.

4. The Sun is a disk, not a point

When the Sun sits on a ridge line, half of it can be visible. Treating it as a point flips the site from lit to dark in one step. SouthWatch computes the visible fraction of the disk as a circular segment:

text
x = clamp( (θh − e☉) / R☉ , −1, 1 )        R☉ ≈ 0.267°
f = ( acos(x) − x·√(1 − x²) ) / π

It also accounts for limb darkening (the Sun's edge is dimmer than its centre, which matters exactly when only the edge shows) and for eclipses, when Earth itself covers the Sun as seen from the site.

5. Can it talk to Earth?

From the pole, Earth hangs low on the horizon and wobbles over the month. The obvious test, "is Earth's centre above the skyline?", is subtly wrong: you don't talk to Earth's centre, you talk to a ground station. Earth is almost 2° wide as seen from the Moon, so a station near its edge can be visible while the centre is hidden, or the reverse.

SouthWatch tests the direction to each NASA Deep Space Network complex (Goldstone, Madrid, Canberra), and requires the Moon to be at least 10° above that station's own horizon. The signal's one-way light time, about 1.19 to 1.36 seconds depending on the Earth–Moon distance, is computed live beside it.

6. Every number says how much to trust it

TagMeaningExample
MEASUREDFrom spacecraft dataLOLA elevation
COMPUTEDPhysics applied to real dataSun elevation, horizon blocking, light time
MODELEDA labelled simplificationSolar power estimate, relay orbit

Before writing the code I stress-tested the plan from a physics angle and a mission-operations angle and logged 25 gaps: the horizon cut off too close, an azimuth step coarser than the Sun, Earth's centre instead of a ground station, missing eclipses, a landing region treated as a single point. Each became a formula change before it could become a wrong number on screen.

What I take from it as an engineer

This is the most physics I've put into software, and the lesson wasn't a formula. It was that honesty is a feature. A dashboard that labels its estimates, credits its data and admits what it doesn't model is more useful to a real planner than a prettier one with confident wrong numbers. The hackathon is on 14–15 November; next on my list are golden tests against NASA's SPICE reference values.

Sources

Frequently asked questions

Why is the lunar south pole so important for missions?

Some ridges there are lit most of the year, which means near-continuous solar power, while nearby permanently shadowed craters hold water ice. Power and water a few kilometres apart is rare anywhere in the solar system.

Why not compute the horizon live in the browser too?

Marching over terrain in 1,440 directions for every site is heavy and never changes. Doing it once offline leaves the browser with the part that changes every second: where the Sun and Earth are.

Is SouthWatch an official NASA tool?

No. It is my independent project for NASA Space Apps Challenge 2026, built on NASA's public data, and it is not endorsed by NASA.

  • space
  • physics
  • threejs
  • nasa-data
  • aetrova