nx_atmosphere.nx
buildroot/runtime/nx_atmosphere.nx
about
nx_atmosphere.nx -- atmospheric scattering math primitives.
Per honest audit 2026-05-16: visual quality of a world depends on
atmospheric depth, fog distribution, and sky color. This primitive
ships substrate-native math for:
- Per-body atmospheric coefficients (Rayleigh + Mie scaling)
- Beer-Lambert extinction along a viewing distance
- Sky color as a function of zenith + sun angles (Preetham-style)
- Fog density as a function of altitude
Used by the rasterizer (queued) and by atmospheric quality graders.
genealogy_id: rayleigh_1871 + mie_1908 + preetham_1999_practical_sky +
hosek_wilkie_2012_analytic_skylight
lineage_id: nx_atmosphere_scattering_q14_v1
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_tier.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 25 | const NX_MAGIC_6029: i64 = 6029 |
| 26 | const NX_MAGIC_2212: i64 = 2212 |
| 27 | const NX_MAGIC_5800: i64 = 5800 |
| 28 | const NX_MAGIC_6200: i64 = 6200 |
| 30 | const NX_ATM_Q: nx_int = 16384 |
| 45 | const NX_BODY_SUN_LOCAL: nx_int = 0 // local alias for SUN |
| 46 | const NX_BODY_MERCURY_LOCAL: nx_int = 1 |
| 47 | const NX_BODY_VENUS_LOCAL: nx_int = 2 |
| 48 | const NX_BODY_EARTH_LOCAL: nx_int = 3 |
| 49 | const NX_BODY_MARS_LOCAL: nx_int = 4 |
| 50 | const NX_BODY_TITAN_LOCAL: nx_int = 16 |
functions
| 52 | func nx_atmosphere_rayleigh_q14(body_id: nx_int) -> nx_int |
| 61 | func nx_atmosphere_mie_q14(body_id: nx_int) -> nx_int |
| 74 | func _atm_exp_neg_q14(x_q14: nx_int) -> nx_int |
| 100 | func nx_atmosphere_extinction_q14( |
| 119 | func nx_atmosphere_fog_density_q14( |
| 138 | func nx_atmosphere_sky_color_q14( called by 1: main |
| 197 | func main() -> i64 |