Skip to content

Project tilted cameras with the engine's field of view - #43

Merged
wf9a5m75 merged 1 commit into
developfrom
fix/screen-projection-tilt
Nov 12, 2026
Merged

wf9a5m75 merged 1 commit into
developfrom
fix/screen-projection-tilt

Conversation

@wf9a5m75

Copy link
Copy Markdown
Contributor

Summary

WebMercatorScreenProjection gains toScreenOffset / fromScreenOffset overloads that take the camera's vertical fov. With a fov and a tilt they use the MapLibre GL JS pinhole model (camera at (H/2)/tan(fov/2) from the centre, pitched by the tilt) instead of the flat similarity.

The flat model drifted further the deeper a point was: 34 px at tilt 30 and 114 px at tilt 60 near the centre, 247 px at a padded centre. A ray above the horizon returns null. The existing overloads are unchanged.

Tests

WebMercatorScreenProjectionTiltTest checks the projection against an independent 3D camera at tilt 0/30/60 and several bearings, round trips, and the horizon.

Merge this before the MapTiler and Longdo PRs that call the new overloads.

WebMercatorScreenProjection gains toScreenOffset/fromScreenOffset overloads taking the camera's vertical fov. With a fov and a tilt they use the MapLibre GL JS pinhole model (camera (H/2)/tan(fov/2) from the centre, pitched by the tilt) instead of the flat similarity, which drifted further the deeper a point was: 34 px at tilt 30 and 114 px at tilt 60 near the centre, 247 px at a padded centre. A ray above the horizon gives null. The existing overloads are unchanged. Tests check the projection against an independent 3D camera at tilt 0/30/60 and several bearings, round trips, and the horizon.
@wf9a5m75
wf9a5m75 merged commit 278809b into develop Nov 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant