Skip to content
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

Improve terrain rendering when using globe projection #4825

Merged
merged 9 commits into from
Oct 29, 2024

Conversation

ibesora
Copy link
Collaborator

@ibesora ibesora commented Oct 13, 2024

This PR fixes #4792
When terrain is used we first render all layers on an offscreen framebuffer and then use it as a texture on the terrain.
When using globe in addition to terrain, the wrong matrix was being used so tiles were projected in the wrong place in the offscreen framebuffer. This fixes it on raster layers by using the mercator fallback matrix when rendering to the offscreen buffer. I'll tackle vector layers in another PR.
Note that there can be further improvements on terrain by using an orthographic projection when rendering to the offscreen buffer but I'll tackle that in another PR.

Launch Checklist

  • Confirm your changes do not include backports from Mapbox projects (unless with compliant license) - if you are not sure about this, please ask!
  • Briefly describe the changes in this PR.
  • Link to related issues.
  • Include before/after visuals or gifs if this PR includes visual changes.
  • Write tests for all new functionality.
  • Document any changes to public APIs.
  • Post benchmark scores.
  • Add an entry to CHANGELOG.md under the ## main section.

@codecov-commenter
Copy link

codecov-commenter commented Oct 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.56%. Comparing base (cacd433) to head (a983859).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4825      +/-   ##
==========================================
+ Coverage   90.51%   90.56%   +0.05%     
==========================================
  Files         265      265              
  Lines       38095    38098       +3     
  Branches     3194     3188       -6     
==========================================
+ Hits        34480    34503      +23     
+ Misses       2636     2624      -12     
+ Partials      979      971       -8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@HarelM
Copy link
Collaborator

HarelM commented Oct 13, 2024

I've added a few minor comments.
Don't forget to add a few render tests to make sure this behavior does not break in the future...

@ibesora ibesora closed this Oct 28, 2024
@ibesora ibesora force-pushed the ib/fix-terrain-on-globe-final branch from 47ea4bb to 20ce115 Compare October 28, 2024 11:14
@ibesora ibesora reopened this Oct 28, 2024
@ibesora ibesora marked this pull request as ready for review October 28, 2024 12:51
Copy link
Collaborator

@HarelM HarelM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a unit test maybe, or another render test that show the issue better.
Otherwise, this is approved.

@ibesora ibesora force-pushed the ib/fix-terrain-on-globe-final branch from cc96506 to a983859 Compare October 29, 2024 11:06
@ibesora ibesora merged commit 085d54d into maplibre:main Oct 29, 2024
15 checks passed
@ibesora
Copy link
Collaborator Author

ibesora commented Nov 12, 2024

I'll tackle vector layers in another PR.

This was merged via #4977

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.

tiles are not displayed correctly when both terrain and the new globe projection are used
3 participants