CesiumGS / CesiumGS/cesium-native
Handle quadtree raster overlay edge case that can (rarely) result in missing detail
- Dominant language
- C++
- Stars
- 623
- Forks
- 277
- PR merge metrics
- No merged PRs in 30d
Description
After #252, RasterOverlays that are quadtree tiled follow a process roughly like this to create an overlay texture:
1. Select an appropriate quadtree level for the desired geometric error.
2. Figure out which quadtree overlay tiles at that level cover the geometry tile.
3. Attempt to load all the tiles.
4. For each failing tile, get a tile for the parent quadtree level instead (repeating as necessary until we get an image that covers the desired rectangle)
5. If the resulting tiles are all from the originally desired level (step 1) or a mix of desired-level and ancestor levels, then blit them all together to create one texture for the geometry tile and we're done.
6. But if the resulting tiles are _all_ from an ancestor, consider this overlay tile to have failed, and instead use the parent _geometry_ tile texture for this overlay. This is an optimization to avoid redundant texture data, and also keeps us from endlessly upsamping geometry tiles.
Mostly this works great, but there's a corner case that isn't handled.
Consider a geometry tile (A) that is determined in step (1) to use quadtree level 15. That tile has child geometry tiles (B), all of which (because of their geometric error) map to quadtree level 17. So none of the geometry tiles map directly to quadtree level 16. There's a gap.
Now imagine that the level 17 quadtree tiles don't exist. When we try to load them, the load fails. So by the algorithm described above, the (B) tiles will fail to load the level 17 quadtree tiles, try to load the level 16 tiles instead, and succeed. So far, no problem. But then step (6) above means that we'll throw away those level 16 quadtree tiles and instead use the texture from the (A) geometry tile, with its level 15 data. So effectively we never show the level 16 quadtree overlay tiles, and the layer isn't as detailed as it could be.
To fix this, we would want to note that the parent geometry tile's texture isn't as good as we'd like, and not throw away our level 16 data in step 6. But this is tricky.
It's also likely to be pretty rare, because geometric error is usually arranged so we won't end up skipping a level like that. The geometric error at level (B) would have to be less than half the geometric error at level (A). And it would have to be right at the leaves of the quadtree pyramid. So that's why I'm writing an issue rather than doing something drastic to fix this as part of the PR.
Contributor guide
Research direction
No source file, test, or entry point is named. Start by tracing the RasterOverlays quadtree overlay-texture process described in the issue, focusing on the ancestor fallback and parent geometry texture decision. Done means the level 16 overlay data is retained for the described skipped-level case instead of being replaced by the level 15 geometry texture.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100