-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shift horizon towards center to reduce the number of tiles loaded #10304
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good and is very simple and effective. Once we have tests passing this should be good to go. Have you been able to run performance benchmarks on this? We have a fixture on heavily pitched views for 3d.
src/geo/transform.js
Outdated
const farZ = furthestDistance * 1.01; | ||
|
||
// Move the horizon closer to the center. 0 would not shift the horizon. 1 would put the horizon at the center. | ||
const horizonShift = 0.10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity I tested out other values, I think 10% is a good choice and great compromise. Trying to go higher than that starts showing horizon clipping, and is being visually distracting.
@ansis I updated the 3d fixture and ran this branch against v2.0.1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
hiding labels whose anchor is above the shifted horizon and caused cascading label changess
a4f1485
to
b65b155
Compare
Wouldn't that be already configurable by specifying top padding value (though that would shift down center of map)? |
This shifts the horizon down a bit to reduce the number of tiles in highly pitched views. Everything beyond the new horizon is clipped. The skybox is shifted down to meet the horizon.
The horizon is currently shifted 10% of the distance from the true horizon to the center. Specifying the shift as a fraction keeps the horizon at the same real-world locations as pitch changes. The value is not user-configurable right now but we may want to expose it once fog lands. Fog might also make it possible to shift the horizon even further. By blending the map with the sky the sharp edge might be less jarring.
The number of tiles dropped depends on the view. This view loads 20% less tiles:
The perspective of the map is not affected.
Launch Checklist
mapbox-gl-js
changelog:<changelog>Shift horizon down slightly to reduce the number of tiles loaded for highly-pitched maps.</changelog>