Repository navigation
fix: elevation smoothing artifacts for small bboxes and search double fire - #789
Conversation
…-fire - Compute output_sigma as max(sigma_from_grid, sigma_terrain) using a single Gaussian blur pass, preventing Voronoi block cliff edges and SRTM surface artifacts for small bounding boxes (~100-200m). Large-area behaviour is unchanged (sigma_from_grid dominates above ~7.5 km crossover). min/max and output heights derive from the same blur field, eliminating any possibility of range-decoupling division-by-zero. - Fix search.js double-fire: button/Enter handlers now call clearTimeout() before performSearch(), and in-flight Ajax requests are aborted before issuing a new one via activeRequest.abort().
|
⏱️ Benchmark run finished in 0m 27s 📈 Compared against baseline: 30s 🟢 Generation time is unchanged. 📅 Last benchmark: 2026-03-15 00:04:38 UTC You can retrigger the benchmark by commenting |
There was a problem hiding this comment.
Pull request overview
This PR targets two user-facing issues: terrain generation artifacts for very small bounding boxes, and duplicate/double-fired city searches in the GUI.
Changes:
- Adjust elevation blur selection to use a single blur pass with
output_sigma = max(sigma_from_grid, sigma_terrain)and compute min/max from the same blurred field. - Add GUI search debouncing fixes by clearing pending timeouts on click/Enter and aborting in-flight Ajax requests before issuing a new one.
- Add tests around the new sigma selection behavior and expected crossover.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
src/gui/js/search.js |
Adds timeout clearing and in-flight request aborting to reduce duplicate/stale searches. |
src/elevation_data.rs |
Updates blur sigma selection logic and min/max derivation; adds tests for sigma behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
search.js: - Capture jqXHR in local var and guard callbacks against stale responses (older request's callback no longer clears newer activeRequest) - Use jQuery textStatus parameter instead of xhr.statusText for abort detection elevation_data.rs: - Remove .max(1.0) clamp on native_resolution; guard sigma_terrain with .max(1e-6) instead, so scale < 1.0 no longer over-blurs - Add sentinel validation after min/max reduction: fall back to flat terrain if no finite samples exist (all-NaN grid from failed tile downloads) - Strengthen test_output_sigma_same_field_invariant to run actual blur on synthetic grid and verify every cell lies within derived [min, max]
There was a problem hiding this comment.
Pull request overview
This PR addresses two user-facing issues: terrain elevation smoothing artifacts on small bounding boxes during world generation, and duplicate/stale city search requests in the GUI.
Changes:
- Adjust elevation smoothing by selecting
output_sigma = max(sigma_from_grid, sigma_terrain)and deriving min/max from the same blurred field to avoid small-area artifacts. - Prevent overlapping/stale city search responses by aborting in-flight Ajax requests and clearing pending debounce timeouts before triggering a new search.
- Add unit tests around sigma selection/crossover and a “single blur field” invariant.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/gui/js/search.js |
Adds request tracking/abort logic to reduce duplicate search behavior and prevent stale responses from overwriting newer ones. |
src/elevation_data.rs |
Revises Gaussian blur sigma selection for small bboxes and adds tests to guard against regressions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Rename native_resolution to blocks_per_tile_pixel (unit was blocks, not metres) - Clamp output_sigma to grid_size/2: beyond that the kernel exceeds the grid and extra sigma only wastes computation with no visual effect - Abort in-flight Ajax request in hideResults() so stale responses don't re-display results when the user clears the search input
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Compute output_sigma as max(sigma_from_grid, sigma_terrain) using a single Gaussian blur pass, preventing Voronoi block cliff edges and SRTM surface artifacts for small bounding boxes (~100-200m). Large-area behaviour is unchanged (sigma_from_grid dominates above ~7.5 km crossover). min/max and output heights derive from the same blur field, eliminating any possibility of range-decoupling division-by-zero.
Fix search.js double-fire: button/Enter handlers now call clearTimeout() before performSearch(), and in-flight Ajax requests are aborted before issuing a new one via activeRequest.abort().