Backward Monte Carlo Sky Radiance Spectral radiative transfer for a planetary atmosphere, rendered from a spacecraft — current target: Mars from ~100,000 km.

This code renders the full sky (or a planetary disk) as seen by an observer, by tracing light backward from the camera through a spherical, scattering atmosphere and off the ground. It is an independent implementation of the MYSTIC-style method — the backward Monte Carlo technique with next-event ("local") estimation of Mayer (2009), the algorithm behind MYSTIC / libRadtran — with several variance-reduction and modeling choices of its own (see Relationship to MYSTIC). Per color channel it produces an absolute radiance image that is then gamma-mapped to RGB.

All-sky polar projection of Mars rendered by the Monte Carlo code
Polar all-sky render, Mars dust atmosphere (single-scattering albedo ω₀ = 0.92 / 0.82 / 0.65 for R/G/B; surface aerosol optical depth ~1.2 green; detached dust slab AOD 0.05). Produced by this model.
Click the thumbnail for the full-resolution render.
Camera ray Forced first scatter Random walk (natural free paths) Local estimate to Sun at each vertex + deterministic direct terms Pixel radiance

1Geometry & observer

The marcher is fully spherical and planet-aware: a planet radius is selected per body (Mars is the default; Earth, Titan and Pluto blocks exist). The terrain datum sits at htmin = 0 and the top of atmosphere at htmax = 100 km; the observer height is a command-line override.

2The backward random walk

nray photons are launched per pixel from the observer along the line of sight. The walk is sun-independent: it depends only on the atmosphere along the path, never on where the Sun is. The Sun enters only through the local estimate (§3).

3The local estimate (next-event)

At every scattering vertex, the deterministic contribution of light arriving directly from the Sun is added — this is the only place solar geometry enters, and it keeps variance low (no extra rays are spawned toward the Sun):

rad_local_est = 3e9 · weighted_pf · sun_trans      (atmospheric scatter)
rad_local_est = 6e9 · weighted_pf                  (ground bounce)

summed as   Σ  rad_local_est · photon_wt

4Deterministic direct terms (noise-free)

Two contributions are computed analytically rather than sampled, so they carry no Monte Carlo noise:

Direct surface
prob_1st_trans · rad_direct_sfc — the unscattered camera ray reaching the ground, reflecting toward the Sun (12e9 · sin(alt_2sun) · trans(sun-path) · albedo · fBRDF). Gives subsolar cosine-brightening and surface terrain detail; fBRDF is the simplified-Hapke surface shape factor (see §7).
Direct sky
prob_1st_trans · rad_sky_dir — the unscattered straight-through term.

The final per-pixel radiance combines the direct terms with the averaged walk contribution:

rad_ray = prob_1st_trans·rad_sky_dir  +  rad_dir_g  +  rad_sky_sum / nray

5Phase function & delta-scaling

Aerosol scattering uses a per-color two-term Henyey–Greenstein function (forward/back blend with asymmetries g₁, g₂, the sharp forward lobe reaching g₂ ≈ 0.91–0.945). A sampling CDF is built once and reused.

Delta-scaling tames the runaway multiple-forward-scattering that the sharp coarse lobe would otherwise produce. A per-color truncation angle (the coarse/fine-lobe crossover, ~15°, parameter-free) removes the forward cone from the walk's sampling CDF and reassigns the removed fraction f to the unscattered beam (ω₀′ = ω₀(1−f)/(1−ω₀f), ext′ = ext·(1−ω₀f)). Crucially, the local-estimate deposit keeps the full phase function (TMS correction), preserving the bright forward limb while stabilizing the walk.

6Atmosphere & aerosol profile

7Surface albedo

8Absolute calibration

The model carries one geometry-independent constant: 3e9 = F/4π for atmospheric scattering, 6e9 for ground reflection, and 12e9 = F for the direct surface term (Lambertian normalization, reshaped by the surface BRDF factor). All solar-geometry and path dependence is carried by the transport itself; a single re-tune of this constant rescales the absolute brightness if a physics change shifts the overall level.

9Summary of the data flow

For each pixel and color channel:

  1. Launch nray photons backward from the observer.
  2. Force the first scatter inside the line-of-sight optical depth; set the photon weight.
  3. Random-walk by natural free paths, decaying the weight by ω₀ (and surface albedo at bounces) until it falls below threshold.
  4. At every vertex, add the next-event estimate of direct sunlight, weighted by the full phase function and the tabulated Sun-path transmission.
  5. Add the two deterministic direct terms (sky + surface).
  6. Average over rays, scale by the calibration constant, and gamma-map the three channels to RGB.

10Relationship to MYSTIC — and what's original here

This solver follows the same algorithm family as MYSTIC (the libRadtran Monte Carlo solver), as formulated by Mayer (2009), but it is an independent implementation with its own variance-reduction structure, an optimization for the space-observer geometry, and application-specific Mars physics. In some respects — full 3-D geometry, measured Mie scattering — it is also deliberately simpler than MYSTIC.

Shared with MYSTIC (the standard backward-MC core)

Original choices here

Where it is simpler than MYSTIC