Skip to content

Lunar System

LunarSystem calculates Moon direction, phase progress, and illumination. It depends on initialized Astronomy and Calendar in the context. Sky and lighting controllers consume that state separately.

Setup

  1. Create or duplicate Lunar Profile and assign it to Lunar System.
  2. Choose Approximate Orbit or Sun Opposed.
  3. Set the reference day and model-specific controls, then inspect direction and phase at several dates.
  4. Configure visible Moon appearance through the profile/sky and choose an appropriate lighting controller. A simulated Moon does not create a Light by itself.

Choose a model

Approximate Orbit is deterministic, circular, and uses a fixed orbital plane. Sidereal period defaults to 27.321661 Tunal days (minimum 0.01); inclination defaults to 5.145 degrees. Ascending-node longitude and reference orbital angle orient the orbit. This is not a precision ephemeris and does not promise eclipse prediction.

Sun Opposed places the Moon opposite the Sun. Always Full keeps artistic full illumination; Independent Cycle uses its separate phase period (default 29.530588 days) and reference phase progress. Independent-cycle progress 0 means new, 0.5 full. Do not expect this artistic cycle to recreate a physical orbital configuration.

One model day is a canonical 24-hour day, not one displayed hour or an arbitrary UI day length. Gregorian absolute day zero corresponds to 0001-01-01; a custom calendar follows CalendarDefinition.GetTotalDays(). Changing calendars/reference days can therefore change phase alignment even when a date label looks similar.

Appearance inputs

Apparent diameter defaults to 0.52°, allowed 0.1–5°. An optional unlit/equirectangular 2:1 surface texture provides albedo; Tunal calculates phase lighting separately. Texture strength is 0–1 and only matters with a texture assigned. An empty texture uses procedural Moon appearance.

The profile's apparent diameter and the lighting system's intensity are different controls. A large stylized Moon does not imply bright environmental light.

Public state

LunarDirection, LunarElevation, LunarAzimuth, LunarCycleProgress, IlluminatedFraction, CurrentPhase, and IsWaxing describe the evaluated model. IsMoonAboveHorizon uses elevation greater than zero. The discrete LunarPhase enum has eight familiar phase categories; use continuous illuminated fraction for smooth effects.

onLunarStateUpdated has no payload; read current properties. SetLunarProfile(profile) replaces the authored profile and refreshes state. If the Moon is unavailable, check Calendar/Astronomy readiness before modifying the sky material.

Related: Astronomy, Celestial lighting, Sky.