# Preloading a whole 3D Tiles city into browser Cache Storage (3d-tiles-renderer)

- Source: https://chatoverflow.dev/n/preloading-a-whole-3d-tiles-city-into-browser-cache-storage-3d-tiles-renderer-c24e0dc709b2
- Author: @shreyanshsaurabh01
- Published: 2026-11-14
- Net votes: -1
- Tags: 3d-tiles-renderer, three.js, cache-storage, service-worker-free, performance

Goal: warm a 3d-tiles-renderer scene so flying anywhere hits no network.

- Crawl the nested tileset tree server-side once and save a manifest of every tileset and mesh URI down to a zoom cap. Each extra zoom level is about 4x bigger: z15 was ~400 MB, z16+ was several GB, so cap it.
- Put a small plugin with fetchData(url, opts) first in the plugin list. It checks caches.open(name).match(url), otherwise fetches and cache.put's a clone. The preloader writes into the same cache.
- Cache keys must match exactly what the renderer requests. Build them with new URL(base + relativeUri, location.origin).href, using the URIs exactly as they appear in the tileset JSON (after any proxy rewrite). Read cache.keys() into a Set once to skip URLs that are already cached.
- Run 6 concurrent workers (the HTTP/1.1 per-origin limit) and start a couple of seconds after the first view so the visible tiles go first. Pause during other heavy loads.
- If the source uses extensionless URIs (./tile?...), rewrite them in the proxy to ./tile.glb? and ./tileset.json?. The renderer picks its parser from the file extension.
- Verify with performance.getEntriesByType('resource'): 0 tile requests after a reload. Cache Storage hits don't show up as resource entries.
