Related to #1575
Related to #1327
Features
- Mouse interactions, raycasting against shapes
- Scale lines, points based on projected world size
Performance
- Offscreen rendering in Webworkers
- Redraw only visible tiles
- Fall back to loaded parent tile definitions
- Consider per-shape bounding boxes for skipping rasterization
- Pre-parse the MVT shapes (possibly even to Path2Ds) to avoid iterative MVT fetching
Technical
- Afford ability to "register" PMTiles archive as a protocol or source for fetching data from. The archive could then be used and referenced by other overlays like WMTS, etc.
- Afford ability to "register" MVT parser / rasterizer as a utility for handling loaded tiles. Then if WMTS, XYZ, etc overlays load MVT files then they will work with any tiling system.
Other Approaches
Triangulated Polygons
Rather than rasterizing the vector shapes using the canvas API the shapes can be triangulated using earcut (or three.js' built in triangulate function) and then rasterized to render targets used for overlays with WebGL / WebGPU. This would (hopefully) be faster than rasterizing via the canvas API when applying overlays.
Things like points and lines will need to be constructed with miter joints to enable a visible "thickness", which can then be adjusted in vertex shaders for scaling.
Flat Vector Maps
Extending from the above polygon triangulation: These triangulated geometries can subsequently be used to render the map directly without an intermediate rasterization. Rendering the meshes directly would be faster, result in more crisp edges, and allow for more clean, controllable transitions between LoDs.
For supporting ellipsoidal globes: The shapes can have edges inserted in a grid pattern that can subsequently be transformed to the shape of the surface of globe.
Dynamically scaling overlays / maps
With dynamically scaling, triangulated polygonal shapes, the shapes can be rendered every frame to scale the features as necessary. Whether rendering the shapes directly (eg a flat map) or rendering the overlays, they can be rendered every frame to update the annotation scales, giving a look more consistent with other map systems.
This is something that Overture maps, MapboxGL, and Maplibre do.
Cascaded rendering
Use a shadow-cascade-like system with a few textures being fit to the frustum with lower LoDs being used further from the camera. These cascades can then be sampled by the terrain fragment shader with fade blend transitions at the cascade boundaries.
The complexity comes when we want to sample web-mercator projection data sets, which can result in artifacts when performing a mercator -> equirectangular conversion.
Direct Rendering
Rather than rendering to an intermediate overlay texture we could embed the vector shapes in a storage buffer or texture and sample the shapes at terrain rasterization time. This would give perfect rasterization quality and crisp lines independent of zoom level, etc if it can be done performantly.
Related to #1575
Related to #1327
Features
Performance
Technical
Other Approaches
Triangulated Polygons
Rather than rasterizing the vector shapes using the canvas API the shapes can be triangulated using earcut (or three.js' built in triangulate function) and then rasterized to render targets used for overlays with WebGL / WebGPU. This would (hopefully) be faster than rasterizing via the canvas API when applying overlays.
Things like points and lines will need to be constructed with miter joints to enable a visible "thickness", which can then be adjusted in vertex shaders for scaling.
Flat Vector Maps
Extending from the above polygon triangulation: These triangulated geometries can subsequently be used to render the map directly without an intermediate rasterization. Rendering the meshes directly would be faster, result in more crisp edges, and allow for more clean, controllable transitions between LoDs.
For supporting ellipsoidal globes: The shapes can have edges inserted in a grid pattern that can subsequently be transformed to the shape of the surface of globe.
Dynamically scaling overlays / maps
With dynamically scaling, triangulated polygonal shapes, the shapes can be rendered every frame to scale the features as necessary. Whether rendering the shapes directly (eg a flat map) or rendering the overlays, they can be rendered every frame to update the annotation scales, giving a look more consistent with other map systems.
This is something that Overture maps, MapboxGL, and Maplibre do.
Cascaded rendering
Use a shadow-cascade-like system with a few textures being fit to the frustum with lower LoDs being used further from the camera. These cascades can then be sampled by the terrain fragment shader with fade blend transitions at the cascade boundaries.
The complexity comes when we want to sample web-mercator projection data sets, which can result in artifacts when performing a mercator -> equirectangular conversion.
Direct Rendering
Rather than rendering to an intermediate overlay texture we could embed the vector shapes in a storage buffer or texture and sample the shapes at terrain rasterization time. This would give perfect rasterization quality and crisp lines independent of zoom level, etc if it can be done performantly.