Skip to content

Add example: render a 3D Tiles quantized-mesh terrain tile (#4493)#7952

Open
clement-igonet wants to merge 7 commits into
maplibre:mainfrom
clement-igonet:poc/3d-tiles-terrain-4493
Open

Add example: render a 3D Tiles quantized-mesh terrain tile (#4493)#7952
clement-igonet wants to merge 7 commits into
maplibre:mainfrom
clement-igonet:poc/3d-tiles-terrain-4493

Conversation

@clement-igonet

@clement-igonet clement-igonet commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

POC for #4493 ("Add 3D Tiles as a source for the terrain layer").

Decodes a real Cesium World Terrain quantized-mesh tile (Mont Blanc massif, no library dependency) and renders it via a custom WebGL layer, with 5 named summit pins for a real-world sanity check. No core changes, no Source/Terrain integration - that's phase 2, in #7953.

Launch Checklist

  • Confirm your changes do not include backports from Mapbox projects
  • Briefly describe the changes in this PR.
  • Link to related issues.
  • Confirm you have read our AI policy here.

Assisted-By: Claude Sonnet 5 (claude-sonnet-5)

@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.38%. Comparing base (4435459) to head (92ed220).
⚠️ Report is 26 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7952      +/-   ##
==========================================
+ Coverage   93.25%   93.38%   +0.13%     
==========================================
  Files         290      290              
  Lines       24650    24579      -71     
  Branches     6471     6471              
==========================================
- Hits        22987    22954      -33     
+ Misses       1663     1625      -38     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Proof of concept for the phasing proposed on maplibre#4493 ("Add 3D Tiles as
a source for the terrain layer"): decodes a real quantized-mesh binary
tile (header, vertex data, triangle/edge indices - the format used
by Cesium/3D Tiles terrain) with no library dependency, and renders
it via a custom layer using the origin-relative rendering technique
from maplibre#4871/maplibre#7946.

Uses a single tile (zoom 9) of real Cesium World Terrain data
covering the whole Mont Blanc massif, so the demo is checkable
against reality rather than a synthetic fixture, while keeping the
bundled data to the minimum needed. Pins five named summits (Mont
Blanc, Aiguille du Midi, Mont Blanc du Tacul, Dôme du Goûter,
Aiguille du Plan) with floating labels, each rendered/positioned in
the same origin-relative coordinate space as the terrain mesh so
they track the actual sampled elevation instead of a flat ground
plane. Raises maxPitch to 85 to allow a more dramatic viewing angle.

Deliberately out of scope for this phase: dynamic LOD tile
selection, elevation queries, layer draping, and occlusion-aware
tile throttling - those belong to the "first valuable feature" and
"hardening" phases proposed on the issue.
@clement-igonet
clement-igonet force-pushed the poc/3d-tiles-terrain-4493 branch from 61758d2 to 6c36526 Compare July 16, 2026 05:11
@clement-igonet
clement-igonet marked this pull request as ready for review July 16, 2026 12:20

@CommanderStorm CommanderStorm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please de-vibe your code. that is very sloppy, for example when it comes to comments. Not great...

Also, make the example minimal, so remove the markers and such, only the terrain handling code and only the minimal amount of code nessary..
Is there a lib we can use to help and trim down this code?

@CommanderStorm
CommanderStorm marked this pull request as draft July 19, 2026 10:31
Decode via @here/quantized-mesh-decoder (MIT) instead of a hand-rolled
decoder, drop the summit markers and multi-tile scaffolding, keep only
the terrain handling. 507 to 192 lines.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@clement-igonet

clement-igonet commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

OK.
The example is down from 507 to 192 lines, terrain handling only.

@clement-igonet
clement-igonet marked this pull request as ready for review July 19, 2026 14:33

@CommanderStorm CommanderStorm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better, but still needs a bit of simplifcation

Comment thread test/examples/render-a-3d-tiles-quantized-mesh-terrain-poc.html Outdated
Comment thread test/examples/render-a-3d-tiles-quantized-mesh-terrain-poc.html Outdated
Comment thread test/examples/render-a-3d-tiles-quantized-mesh-terrain-tile.html
Drop the header comment, hardcode the fixture tile URL and bounds,
inline the single-use matrix multiply. 192 to 173 lines.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread test/examples/render-a-3d-tiles-quantized-mesh-terrain-tile.html
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@clement-igonet clement-igonet changed the title POC: decode and render a 3D Tiles quantized-mesh terrain tile (#4493) Add example: render a 3D Tiles quantized-mesh terrain tile (#4493) Jul 19, 2026
@HarelM

HarelM commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

I'm not sure, looking only at the image of this example, what this example is really trying to achieve.
Does it work with vector tiles? Does it work with raster tiles? Does it work with building extrusion? contours?
A flying 3D ground as an example is not great.
CC: @safwat-halaby as you are looking into integrating some 3D capabilities to your plugin.

@HarelM HarelM added the need more info Further information is requested label Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

need more info Further information is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants