garage44.eu/jeroen/cartopolis

logclone: git clone https://garage44.eu/jeroen/cartopolis.git

cartopolis-agent · 2026-11-28T20:50:53Z

feat(map): street lamps bright enough to light the street they stand on

At 6,000 lm the lamp pool's lights were lit (48 on the Deck's desktop
rung) and drew nothing: the night is exposed only 1.7 stops under noon,
so the ~40 lux under a lamp came out three stops under middle grey. At
24,000 lm the pools read round each post on the Grote Markt at 21:00 UTC
without washing the square out.

`ShotMetrics::lamp_lights` counts the pool's lit lights, so a capture can
tell an unlit pool from a dim one.
crates/cartopolis/src/systems/dev/shot_harness.rs       |  8 +++++++-
 crates/cartopolis/src/systems/dev/shot_harness/tests.rs |  1 +
 crates/cartopolis/src/systems/map/street_detail.rs      | 12 +++++++++++-
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/crates/cartopolis/src/systems/dev/shot_harness.rs b/crates/cartopolis/src/systems/dev/shot_harness.rs
index 5e933856..c4fe753a 100644
--- a/crates/cartopolis/src/systems/dev/shot_harness.rs
+++ b/crates/cartopolis/src/systems/dev/shot_harness.rs
@@ -942,6 +942,10 @@ pub struct ShotMetrics {
     /// arrived (Overpass, cache, or the toggle), which a capture alone cannot
     /// tell apart from "this town has none of it mapped".
     pub prop_meshes: usize,
+    /// Lamp point lights lit this frame (`street_detail::update_lamp_lights`):
+    /// the pool aimed at the nearest lamps of both sources, 0 by day and on
+    /// the phone rung.
+    pub lamp_lights: usize,
     /// Ambient agents currently **placed on a line** — cars, people and
     /// cyclists, counted apart (`systems::traffic`).
     ///
@@ -1323,7 +1327,7 @@ satellites_drawn,satellites_catalogued,\
 gizmo_render,gizmo_selected,gizmo_axes_hit,\
 grass_patches,grass_slots,grass_rendered,\
 bag_buildings,bag_addresses,bag_berths,surveyed_trees,municipal_trees,surveyed_props,municipal_props,surveyed_lines,surveyed_paving,crop_parcels,nav_marks,level_crossings,prop_colliders,flood_defences,flood_defences_measured,sewer_pipes,sewer_meshes,underground_shapes,underground_meshes,ground_unopened,backdrop_present,backdrop_visible,backdrop_depth_m,backdrop_half_m,tunnel_count,tunnel_road_m,tunnel_meshes,tunnel_rendered,tunnel_ahead_m,tunnel_ahead_road_m,tunnel_entrance_lat,tunnel_entrance_lng,tunnel_entrance_heading,basemap_open_tiles,interior_rooms,interior_storeys,interior_designed,cutaway_storey,building_doors,building_scaffolds,building_fences,building_selected,building_indoors,building_shell_meshes,building_shell_rendered,\
-lod22_dated,lod22_elements,prop_meshes,\
+lod22_dated,lod22_elements,prop_meshes,lamp_lights,\
 traffic_cars,traffic_walkers,traffic_cyclists,crows_air,crows_ground,\
 avatar_meshes,avatar_rendered,avatar_floor_m,eye_ground_m,\
 ground_m,height_patches,\
@@ -5516,6 +5520,7 @@ fn record_metrics(
         lod22_dated: readouts.lod22.dated().0,
         lod22_elements: readouts.lod22.dated().1,
         prop_meshes: readouts.street_detail.spawned_meshes + readouts.tall_structures.spawned(),
+        lamp_lights: readouts.street_detail.lit_lamps,
         traffic_cars: visuals
             .agents
             .iter()
@@ -5699,6 +5704,7 @@ fn record_metrics(
                 level_crossings = m.level_crossings,
                 prop_colliders = m.prop_colliders,
                 prop_meshes = m.prop_meshes,
+                lamp_lights = m.lamp_lights,
                 traffic_cars = m.traffic_cars,
                 traffic_walkers = m.traffic_walkers,
                 traffic_cyclists = m.traffic_cyclists,
diff --git a/crates/cartopolis/src/systems/dev/shot_harness/tests.rs b/crates/cartopolis/src/systems/dev/shot_harness/tests.rs
index e57ee93d..e5d0c133 100644
--- a/crates/cartopolis/src/systems/dev/shot_harness/tests.rs
+++ b/crates/cartopolis/src/systems/dev/shot_harness/tests.rs
@@ -445,6 +445,7 @@ fn sample_metrics() -> ShotMetrics {
         grass_slots: 0,
         grass_rendered: 0,
         prop_meshes: 0,
+        lamp_lights: 0,
         traffic_cars: 0,
         traffic_walkers: 0,
         traffic_cyclists: 0,
diff --git a/crates/cartopolis/src/systems/map/street_detail.rs b/crates/cartopolis/src/systems/map/street_detail.rs
index 3592b8d9..e70f455d 100644
--- a/crates/cartopolis/src/systems/map/street_detail.rs
+++ b/crates/cartopolis/src/systems/map/street_detail.rs
@@ -1729,6 +1729,8 @@ pub struct StreetDetail {
     ped_red_material: Option<Handle<StandardMaterial>>,
     /// The pool of live point lights `update_lamp_lights` re-aims.
     light_pool: Vec<Entity>,
+    /// How many of [`Self::light_pool`] are lit this frame, for the shot harness.
+    pub lit_lamps: usize,
     /// Count of spawned mesh entities, for the shot harness.
     pub spawned_meshes: usize,
     /// When the lane first wanted cells, for [`COVERAGE_WAIT_SECS`].
@@ -1769,6 +1771,7 @@ impl Default for StreetDetail {
             signal_materials: None,
             ped_red_material: None,
             light_pool: Vec::new(),
+            lit_lamps: 0,
             spawned_meshes: 0,
             coverage_wait_since: None,
         }
@@ -2251,7 +2254,13 @@ fn spawn_cell(
 /// Warm sodium-ish lamp colour.
 const LAMP_COLOR: Color = Color::srgb(1.0, 0.85, 0.6);
 /// Lumens of one street lamp at full night.
-const LAMP_LUMENS: f32 = 6_000.0;
+///
+/// Four times a real lantern's 6,000, on purpose. The night is exposed only
+/// 1.7 stops under noon (`exposure-and-adaptation.md`), so at 6,000 lm the
+/// ~40 lux under a lamp drew three stops under middle grey and no pool showed
+/// on the Grote Markt (Deck, 2026-11-28, `lamp_lights` 48); at 24,000 the pools
+/// read round each post without washing the square.
+const LAMP_LUMENS: f32 = 24_000.0;
 /// Light pool radius around the camera.
 const LAMP_LIGHT_RANGE_M: f32 = 160.0;
 
@@ -2429,6 +2438,7 @@ pub fn update_lamp_lights(
 
     let grid = Grid::new(WORLD_CELL_EDGE, WORLD_SWITCH_THRESHOLD);
     let lit = if glow > 0.05 { near.len() } else { 0 };
+    sd.lit_lamps = lit;
     for (i, entity) in sd.light_pool.clone().into_iter().enumerate() {
         let Ok((mut tf, mut cell, mut light, mut vis)) = lights.get_mut(entity) else {
             continue;