marzipano: TextureStore should ignore or deduplicate transparent textures

Hello guys, are there any tile cache limitations? In my implementation and also in your example http://www.marzipano.net/demos/sample-tour/index.html , it looks like that tiles get thrown away after certain amount is loaded. For example, on the link above, when you zoom in almost all the way in, then slowly look around 360 degrees while waiting for all the hires tiles to load, when you quickly turn around 180 degrees the low-res tiles are shown and I have to wait until the hires ones finish loading again, even though they were loaded previously. Or is there another reason for this? Thanks

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Comments: 15 (9 by maintainers)

Most upvoted comments

The caching logic is in the TextureStore class. In a nutshell:

  • Visible tiles are always kept in the cache.
  • Pinned tiles are always kept in the cache (usually the preview level is pinned so that there is always a fall back of last resort).
  • There is an LRU cache of tiles that used to be visible, but no longer are. By default, the cache holds 32 tiles, but this can be changed by passing the previouslyVisibleCacheSize option into the TextureStore.

For gigapixel panoramas, this means that if you zoom in too far (burning through the entire 32-tile LRU cache) and then move outside of that area, you will see the first level (because it’s pinned) until the larger levels load again.

The main challenge with increasing the cache size too much is that memory limitations vary considerably for different devices, and there’s no way to determine how much memory is available. That said, 32 might be a bit too conservative even for today’s low-end hardware.