Saman
  • Work
  • Projects
  • Gallery
  • Blog
  • Resume
  • Notes
GitHub
  • Home
  • Projects
  • Gallery
  • Blog
  • Resume
  • Notes
←All notes
Published August 21, 202510 min readSaman Sahraei

GPU-Friendly Overlays on Top of MapLibre

Synchronising Three.js with MapLibre, instancing markers, and keeping 60 FPS when the camera moves.

WebGLThree.jsMapLibre
GPU-Friendly Overlays on Top of MapLibre

A 3D map overlay is really two renderers sharing one camera illusion. MapLibre owns the basemap; Three.js draws on top. If those cameras drift even slightly, the entire effect breaks trust immediately.

Instancing is non-negotiable

Drawing one mesh per order point will not survive past a few thousand features. InstancedMesh pushes marker transforms to the GPU in a single draw call. Level-of-detail culling trims instances outside the frustum before they hit the pipeline.

  • ◆Custom layer hook for MapLibre + Three.js sync
  • ◆Mercator projection helpers for world-space alignment
  • ◆Lazy-loaded demo chunks so routes stay lightweight
  • ◆Reduced motion and mobile fallbacks where WebGL is constrained
Performance on a map is not a benchmark score — it is whether panning still feels like touching paper.

More notes

November 12, 2025

Tile-Based Caching for Interactive Maps

How square tile keys, spatial caches, and zoom-aware fetching keep dense vendor maps responsive without blocking the UI thread.

October 3, 2025

React Query Patterns for Live Portfolio Demos

Stale times, refetch intervals, and optimistic UI for dashboards that look alive without pretending to be production infrastructure.

June 14, 2025

Design Systems That Survive Nx Monorepos

Shared UI packages, strict boundaries, and typed tokens so landing and dashboard apps do not fork the same button twice.