sunlight through atmosphere

This commit is contained in:
connor committed 2026-10-18 12:09:21 -04:00
1 parent 8c0a1439d7
commit 8e57375059
18 files changed
+1921 -134

No files matched your search

+15 -12
View File
@@ -185,21 +185,24 @@ fn pretty_previews_lift_the_darks_and_leave_space_black() {
#[cfg(feature = "astrokit")]
#[test]
fn lunar_eclipse_darkens_the_moon() {
// Mid-totality: at L1 the whole Moon is in Earth's umbra and reads the bias. At L0
// there are no eclipses on the bodies and it is a full Moon.
fn lunar_eclipse_darkens_and_reddens_the_moon() {
// Mid-totality: at L1 the whole Moon is in Earth's umbra, lit only through Earth's
// atmosphere, red, and brighter at its northern edge, farther from the shadow's
// axis, than at its southern. At L0 there are no eclipses on the bodies, and the
// full Moon at the scene's L0 exposure, 300 times shorter, is bright but short of
// saturation.
let scene = "examples/scenes/lunar-eclipse.toml";
let l0 = render_at(scene, "gpu", "L0");
let l1 = render_at(scene, "gpu", "L1");
assert!(
l0.get_pixel(960, 540).0.iter().all(|&v| v > 150),
"{:?}",
l0.get_pixel(960, 540)
);
assert!(
l1.pixels().all(|p| p.0 == [64; 3]),
"every pixel at the bias"
);
let full = l0.get_pixel(960, 540).0;
assert!(full.iter().all(|&v| v > 1000 && v < 4000), "{full:?}");
let [north, center, south] = [260, 540, 820].map(|y| l1.get_pixel(960, y).0);
// Measured: 695, 287, 145 DN at the north, 592, 164, 77 at the center, 208, 82, 65
// at the south, over a bias of 64.
for p in [north, center, south] {
assert!(p[0] > p[1] && p[1] >= p[2] && p[2] >= 64, "{p:?}");
}
assert!(north[0] > center[0] && center[0] > south[0] && south[0] > 100);
}
#[cfg(feature = "astrokit")]