-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[core] Limit pitch based on edge insets. Fix max Z calculation in getProjMatrix. #15195
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.
Note that the failsafe introduced here introduces a change in behavior that’ll be noticeable in the navigation SDK and navigation-related applications. It’s a sound move, but it does put more pressure on us to implement adaptive zoom levels (aka level of detail): #9037.
Edited the comment: The only change in behavior I see if moving center of perspective towards the bottom, to 84% of screen height. Then app wouldn't try to load e.g. 20000+ tiles but e.g. 500. It would still be very slow but prevents crash and is improvement compared to current state. About change in behavior:
The change here is done this way to prevent current visual change (it is still 60 degrees for smaller padding, like it was), and allow the largest possible pitch that doesn't show area above horizon. Agree, there is a pressure to work on #9037 immediately, with or without changes in this PR. I to work on #9037 Did I understand the "change in behavior" correctly or there is something additional? |
df9e886
to
e5d6e7e
Compare
e5d6e7e
to
89fc482
Compare
84f6ac6
to
5955610
Compare
@1ec5 , @alexshalamov @alexshalamov I'll split the tile cover optimization to other patch - here, contributing unit tests for verifying the upcoming patch against current state. |
5955610
to
b21b82c
Compare
b21b82c
to
bd3f137
Compare
@1ec5 , Work on this, and making the max pitch larger, continues in ##15230. But, I'd like to push this patch first as it is failsafe, preventing out of memory and block but not altering currently max allowed/possible pitch. |
This is a good plan, thank you! |
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.
Suggested changelog entry:
- Fixed an issue where it was possible to set the map’s content insets then tilt the map enough to see the horizon, causing performance issues.
…ProjMatrix. Patch partly fixes #15163 in a way that it doesn't allow loading tens of thousands of tiles and attempt to show area above horizon: Limit pitch based on edge insets. It is not too bad - current limit of 60 degrees stays active until center of perspective is moved towards the bottom, to 84% of screen height. The plan is to split removal of 60 degrees limit to follow up patch. Fix max Z calculation in getProjMatrix. TransformState::getProjMatrix calculation of farZ was complex with possibility to lead to negative z values. Replacing it with simpler, precise calculation: furthestDistance = cameraToCenterDistance / (1 - tanFovAboveCenter * std::tan(getPitch())); TransformState::getProjMatrix calculation of farZ was an aproximation. Replacing it with simpler, but precise calculation. Related to: #15163
bd3f137
to
f37d81d
Compare
Thanks, added. |
Patch partly fixes #15163 in a way that it doesn't allow loading tens of thousands of tiles and attempt to show area above horizon:
furthestDistance = cameraToCenterDistance / (1 - tanFovAboveCenter * std::tan(getPitch()));
Mapping diagram to code:
fD: furthestDistance,
c: cameraToCenterDistance,
small phi: getPitch()
Addresses: #15163