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

WIP Fix images raster layer being clipped on terrain #4269

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dennemark
Copy link
Contributor

@dennemark dennemark commented Jun 14, 2024

This PR should solve issues of raster image layers being clipped when 3d terrain is used. Mentioned in #1559 and #4088

Currently I have only created a failing test that can be started via npm run test-render -- image/raster-terrain (check rendered result ./test/integration/render/tests/image/raster-terrain/actual) and another example that can be accessed via yarn start and opening http://localhost:9966/test/examples/add-image-with-terrain.html in browser.

As mentioned in #1559 the issue seem to come from getTerrainData.

const terrainData = painter.style.map.terrain && painter.style.map.terrain.getTerrainData(coord);

The line const sourceTile = this.sourceCache.getSourceTile(tileID, true); does not return a sourceTile for OverscaledTileID that includes wrapping. So if wrap is 0 the terrain data is loaded, if it is -1 or 1, it won`t load.

const sourceTile = this.sourceCache.getSourceTile(tileID, true);

getSourceTile tries to find the next largest terrain tile with proper terrain data. But it fails for the wrap -1 and 1 tiles.

tile = this.sourceCache.getTileByID(tileID.scaledTo(z--).key);

Image of render test:
grafik

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.

expected image currently is not correct, but actual image neither. needs to be replaced when bug fixed
@dennemark dennemark changed the title Fix images raster layer being clipped on terrain WIP Fix images raster layer being clipped on terrain Jun 14, 2024
@codecov-commenter
Copy link

codecov-commenter commented Jun 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.99%. Comparing base (a3f67eb) to head (bcfeb29).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4269      +/-   ##
==========================================
- Coverage   87.76%   86.99%   -0.77%     
==========================================
  Files         242      242              
  Lines       33081    33081              
  Branches     2156     2211      +55     
==========================================
- Hits        29032    28779     -253     
- Misses       3074     3305     +231     
- Partials      975      997      +22     

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

@HarelM HarelM marked this pull request as draft June 17, 2024 16:01
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.

2 participants