-
-
Notifications
You must be signed in to change notification settings - Fork 791
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
Use Transitionalable
infrastructure for transfrom globeness changes.
#5164
Use Transitionalable
infrastructure for transfrom globeness changes.
#5164
Conversation
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## projection-expression #5164 +/- ##
=========================================================
- Coverage 91.82% 91.81% -0.02%
=========================================================
Files 281 281
Lines 38813 38723 -90
Branches 6815 6727 -88
=========================================================
- Hits 35640 35552 -88
+ Misses 3044 3040 -4
- Partials 129 131 +2 ☔ View full report in Codecov by Sentry. |
I think I managed to incorporate most of the changes I wanted to introduce. |
I've added a few more corrections and fixed a few more of my "TODO"s, please review and let me know what you think. |
Looking at the current experience, I'm not sure I understand the decision to make the transition to mercator only at zoom 12, I think around zoom 7 is more appropriate as you see the map fully and can't see it as a globe. |
When pitch is high, zoom 7 is not enough to "stop seeing the horizon", I now see it. My last question can be ignored. |
I wanted to change the following line in painter as part of this PR: -const renderOptions: RenderOptions = {isRenderingToTexture: false, isRenderingGlobe: style.projection.name === 'globe'};
+const renderOptions: RenderOptions = {isRenderingToTexture: false, isRenderingGlobe: style.projection.transitionState > 0}; But I'm getting the following error in the render tests: @birkskyum @ibesora I know you guys worked on it, is this an actual bug that needs to be fixed related to fog+globe+terrain that is currently a bit "hidden" due to the above change that needs to be done? |
The difference is due to fog not being rendered when globe projection is used. With your change, it is rendered when we've transitioned to mercator, which was something we weren't doing before because the fog matrix is not correctly set when rendering globe. Since the underlying transform is still |
Is it possible to fix this branch to support fog only when mercator transform kicks in? |
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.
Nice improvement on top of the other ones you've been making!
@kubapelc said he'll be able to review this tomorrow, so I'll wait for his feedback before I merge. |
Yeah, I think just returning the Mercator fog matrix on the globe function to compute the matrix would be enough. Will try it later and either push a commit to your branch or report back |
@ibesora thanks for the help! I've changed it to use the current transform so it is more general right now, when in mercator "state" it will use the mercator martix, I must have missed that when refactoring the globe and vertical perspective transfrom, thanks again! |
I didn't check pitched view when setting the constant :D I set it to 12, because I wanted it to be at as zoomed in as possible to hide the transition (the more zoomed in globe is, the more it converges to mercator), but around 13 or 14 there are already floating point artifacts. I think that original logic might be flawed anyway, since the artifacts are likely to appear at different zooms depending on latitude. I still think the default transition should happen at as high zooms to make globe and mercator as similar as possible at the given zoom range, because symbol placement does not support projection transition and is either mercator or globe. The current setting (I'm not sure what it is exactly) seems to work well! Making the transition configurable is a great change! |
Ok, I'll be merging this now. |
* Initial commit to move the logic of transition out to a new file * Remove one line method * Fix build test * Fix projection data bad refactoring * Fix render and size tests * Fix failing unit test * Uncomment unit tests * Fix typo, remove unneeded details provider initialization. Added current transfrom getter * Fix typo * Add back error correction for latitude. * Refactors the `Projection` classed only (#5163) * This refactors the projection class only, without touching other parts of the code. * remove mercator from the code, revert more changes * Refactor camera helper to split the logic for vertical-perspective and mercator (#5162) * Refactor camera helper * Use the helper in the factory. * Fix build test * Fix according to code review * Use `Transitionalable` infrastructure for transfrom globeness changes. (#5164) * Remove duplicate code * Fix lint, add some methods for original branch * Add projection definition in factory * Add has transition to projection * Fix transition value * Remove isRenderingDirty and use hasTransition when needed * Remove the last part of the animation handling in the transform class * More clean-up * Remove some "TODO"s. * Remove reference to globe projection in globe transform * Rename newFrame with recalculateCache * Remove unneeded ifs * Add support for arbitrary projection definitions * Uses mercator matrix when globe is using mercator transform * Improve handling of fog martix in globe transform --------- Co-authored-by: Isaac Besora Vilardaga <[email protected]> * Globe custom layer fixes (#5150) * Simplify custom layer ProjectionData code in mercator transform * Fix globe tiles example * Fix globe projection shader * Add custom layer 3D model after globe->mercator transition render test * Fix custom layer 3D models not rendering when globe transitions to mercator * Move camera to center distance to helper # Conflicts: # src/geo/projection/globe_transform.ts # src/geo/projection/mercator_transform.ts # src/geo/transform_helper.ts # src/geo/transform_interface.ts * Synchronize globe+mercator near and far Z to prevent 3D model disappearing during projection transition * Expose getProjectionData and getMatrixForModel for custom layers, don't use internal API in examples * VerticalPerspectiveTransform should have a valid getProjectionDataForCustomLayer implementation * Add changelog entry * Fix missing docs * Fix docs again * Review feedback * Move nearZfarZoverride to transform helper * Update build size * Review feedback * Change near/far Z override API * Custom layers use internal API * Fix globe custom tiles example * Update build size * Fix typo --------- Co-authored-by: HarelM <[email protected]> * Final removal of TODOs and some minor clean up * Update CHANGELOG.md --------- Co-authored-by: Isaac Besora Vilardaga <[email protected]> Co-authored-by: Jakub Pelc <[email protected]>
Launch Checklist
Hopefully the final PR to make the transition work with the current infrastructure.
I've decoupled the entanglement between globe projection and globe transform by moving the sync logic into the map render flow.
CameraHelper still needs the projection, but I'm not sure I have a good idea how to solve this, state management would've saved a lot of grief here, but we don't have that at the moment.
Removed most of the TODOs I had, still two places that I'm not sure how to solve.
Overall this is ready to be merged to the upstream branch and then to main, maybe...