Add color releif and terrain tests from maplibre-native - #8388
Conversation
7b513a8 to
ba2ec0f
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8388 +/- ##
=======================================
Coverage 94.38% 94.39%
=======================================
Files 298 298
Lines 25737 25737
Branches 6821 6821
=======================================
+ Hits 24293 24294 +1
+ Misses 1444 1443 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ba2ec0f to
3169600
Compare
| @@ -0,0 +1,8 @@ | |||
| ## Attribution | |||
|
|
|||
| Fixtures added for the color-relief render tests. Other files in this folder | |||
There was a problem hiding this comment.
Either add the other files as well or remove this file entirely, I would like to avoid a semi-correct file...
| "test": { | ||
| "height": 512, | ||
| "width": 512, | ||
| "description": "Fill-extrusion over 3D terrain: buildings must sit ON the terrain surface (raised by the DEM elevation at their centroid), not at sea level. Rendered at a pitch over sloping ground so a building drawn without elevation sinks into / floats over the hillside instead of resting on it. Buildings are inline GeoJSON so the test needs no extra tile fixtures beyond the terrain DEM." |
There was a problem hiding this comment.
This is describing what it shouldn't do instead of focusing what the test is showing, please trim this comment a bit.
|
Cool thanks! Added some minor comments but otherwise looks good. |
3169600 to
633bded
Compare
|
Ping me when you need another round of review. |
…errain branch
These two styles exist as render tests on maplibre-native's feature/terrain-3d
branch but have no GL JS counterpart, so native has been validating them against
baselines captured from its own output. Bringing them here gives both engines the
same styles and makes GL JS the oracle.
Both run on fixtures already present: the terrain-shading DEM tiles at
12-2178-1434, 12-2178-1435, 12-2179-1434 and 12-2179-1435, and number/{z}.png.
No new assets.
- terrain/fill-extrusion: extrusions over terrain, checking they sit on the
surface rather than at sea level, at pitch 45 with exaggeration 0.45.
- terrain/occlusion-debug: symbols behind terrain, for label occlusion.
Baselines generated with UPDATE=true. As a check on the harness, the same run
regenerated all 84 existing terrain baselines byte-identically, so these two are
produced the same way as the rest of the suite.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…sion As first ported, terrain/occlusion-debug used exaggeration 0.45. The relief was gentle enough that nothing stood between the camera and the labels, so all 25 rendered and the test would have passed just as happily with occlusion disabled. Raising the exaggeration to 3 puts ridges in front of most of the grid: eight labels survive and seventeen are hidden. text-allow-overlap and text-ignore-placement were already set, so collision cannot hide any of them and occlusion is the only thing that can. Checked that the missing labels are occluded rather than off screen by rendering the same camera and labels with the terrain flattened (exaggeration ~0), which shows all 25. So a regression in occlusion brings seventeen labels back and moves a large fraction of the frame. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
maplibre-native has a `color-relief/low-zoom` case this suite has no equivalent of. The four color-relief tests here are byte-identical to native's, but all sit at zoom 11, so nothing covers the exaggeration scaling applied at low zoom; native wrote this one for a zoom-0 relief intensity bug. Ported unchanged, including its DEM source. It needs four z1 tiles: the DEM fixtures here are four z12 tiles over the Grand Canyon, which cannot render a zoom-1 view of Europe. They are JAXA AW3D30, attributed in the folder README, and byte-identical to the copy maplibre-native uses, so the two engines can be compared on the same DEM. The tiles are WebP, which is new for this suite but renders bit-identically to the same data as PNG - Chrome decodes both to the same RGBA, verified, and the test output is unchanged to 0.000% of pixels. `.gitattributes` gains `*.webp binary`: it sets `* text eol=lf` and lists the other binary formats, so without it git line-ending-normalises the tiles and corrupts them. A DEM carries elevation in the low bits, so that is silent damage rather than a visibly broken image. `.cspell.json` gains `JAXA`. The word list already covers names like it, and the attribution reads `[AW3D30 (JAXA)](...)`, which the `\[\w+` ignore pattern does not cover: that only skips a word sitting directly against the bracket, as in `[GEBCO](...)`. The two engines agree closely on the test - mean absolute channel difference 1.55, with 0.08% of pixels differing by more than 128 - so it lands as something both implementations already satisfy. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…tive Three tests this suite has no equivalent of. `combinations/` has 123 entries and none of them involve color-relief, so nothing here covers what happens when color-relief composites against something other than the background: - `color-relief--hillshade--vector-fill--color-relief--hillshade` puts a vector fill between two relief pairs, so the upper color-relief has to draw over vector geometry. - `color-relief--hillshade--color-relief--hillshade` is the same without the fill, to isolate it. - `color-relief-translucent--hillshade-translucent-low-zoom` stacks two translucent relief layers at zoom 1. Native wrote the first two against a backend-specific regression, where color-relief above a vector layer rendered on one backend and not another. That motivation does not carry over, but the layer ordering they check is engine-independent, and this suite is the reference the native one is compared against. The land DEM points at the JAXA tiles added with the low-zoom test rather than at new fixtures: native's copies read a second, older build of the same data under a different URL template, and both sides now read the one set. The styles are byte-identical between the two repos. Adds six fixtures, each dataset in its own folder with a README covering that folder: `gebco/` for the bathymetry DEM and `osm/` for the vector basemap, alongside the `jaxa/` land DEM. They are three datasets under three licences and two of them sit side by side in these styles, so a folder each keeps the attribution unambiguous. Only z1 is needed for a zoom-1 view, so this is 2.9 MB rather than the 7.2 MB the full fixture set would have cost. The two engines agree closely: mean absolute channel difference 1.5 to 2.5, with under 3.3% of pixels differing by more than 32. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
633bded to
4a04352
Compare
|
@HarelM I think this should be ready for re-review osm pbf files were moved to their own folder so the attribution could be just for those files. Test descriptions have been updated |
This PR brings over tests created for maplibre-native color relief, terrain occlusion, and fill extrusion to maplibre-gl-js so we can have a good baseline for the maplibre-native terrain PR maplibre/maplibre-native#4190
These tests use assets from my own generated JAXA terrain, GEBCO bathymetry, and OSM land vector tiles.
Tests Added
color relief, from already merged core: Update Hillshade Algorithms and add Color-Relief Layer support maplibre-native#3965
test/integration/render/tests/color-relief/low-zoom/
test/integration/render/tests/combinations/color-relief-translucent--hillshade-translucent-low-zoom/
color relief, from already merged # core: fix color-relief/hillshade invisible above fill layers on Metal/Vulkan/WebGPU maplibre-native#4166
test/integration/render/tests/combinations/color-relief--hillshade--color-relief--hillshade/
test/integration/render/tests/combinations/color-relief--hillshade--vector-fill--color-relief--hillshade/
terrain, from in progress Terrain 3D maplibre-native#4190
test/integration/render/tests/terrain/fill-extrusion/
test/integration/render/tests/terrain/occlusion-debug/
Assisted-By: Claude AI was used in generating the tests and migrating them for this PR. (the PR text is my own)
*.bench.ts), post before/after results ofnpm run bench(the compare workflow is intest/bench/README.md).CHANGELOG.mdunder the## mainsection.