-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Target Use case
Match the Google Maps viewport (view & projection matrices)
Proposed feature
WebMercatorViewport
is currently constructed with a altitude
parameter which is used to construct both the view and the projection matrix:
deck.gl/modules/core/src/viewports/web-mercator-viewport.js
Lines 72 to 91 in b80a468
const {fov, aspect, focalDistance, near, far} = getProjectionParameters({ | |
width, | |
height, | |
pitch, | |
altitude, | |
nearZMultiplier, | |
farZMultiplier | |
}); | |
// The uncentered matrix allows us two move the center addition to the | |
// shader (cheap) which gives a coordinate system that has its center in | |
// the layer's center position. This makes rotations and other modelMatrx | |
// transforms much more useful. | |
let viewMatrixUncentered = getViewMatrix({ | |
height, | |
pitch, | |
bearing, | |
scale, | |
altitude | |
}); |
In the projection matrix it is used to calculate the field of view, while in the view matrix it is used to translate the camera in the z-direction.
While this is sufficient for matching the Mapbox style matrices (on which the deck.gl viewports are modeled), it makes it impossible to construct the matrices as used by Google Maps. This is because Google Maps positions the view matrix at an altitude
of 1
(which would correspond to a field of view of 53 degrees) but then constructs a projection matrix which has a field of view of 25 degrees.
It would be good to allow configuration of these two quantities independently, as there is no inherent reason why they must be linked. One way would be to allow scaling the view matrix by a constant (scaleMultiplier
), but other ways are possible (for example, explicitly passing the field of view)
To Do List
- Coding
- Doc update
- What’s new update
- Test