The MapLibre map (fallback unprojection + terrain query).
The position-pickable 3D layers to query (may be empty → terrain only).
Canvas X in CSS pixels, top-left origin (e.g. a click event's e.point.x).
Canvas Y in CSS pixels, top-left origin.
Snap radius in CSS pixels (default 0 = exact pixel — the position is the surface under the cursor tip, "point-shot"). Pass a radius (e.g. 8) to snap near-miss clicks onto the nearest 3D surface within it (screen-nearest, depth-blind — a rescue for edge clicks, at the cost of possible pulls onto a different surface).
The nearest ScenePickResult; never null (the basemap fallback always resolves).
// Click-to-place against the 3D layers rather than the basemap: querying the
// map alone returns terrain under the cursor, which can be metres from the
// geometry you aimed at. The 8 px snap rescues near-miss clicks.
const hit = pickScenePosition(map, [splats, mesh], ev.point.x, ev.point.y, 8);
console.log(hit.position); // never null — falls back to terrain on a miss
Pick the frontmost 3D position under a screen point: the nearest mesh-layer hit (smallest window depth — comparable across layers, which share one frame matrix), else the terrain/basemap under the cursor.