Automatically down-res textures if memory exceeds limit

Hi,

Would like to check if there is a way to automatically down-res the textures of the buildings in terms of city level? Keep getting sbox_fatal_memory_exceeded error because of the large amount of buildings around the zoom I am trying to display at once (zoom 9/10, approximately 500-800 buildings).

I tried playing with the maximumScreenSpaceError but the only setting that does not cause a crash also does not load any buildings (maximumScreenSpaceError : 2048).

I would like to avoid having to render a seperate set of buildings with lowered texture settings as it is not really scalable.

Thank you!

Hi @Rhea, you may be interested in Enforce memory limit for `Cesium3DTilesetCache` by jjhembd · Pull Request #11310 · CesiumGS/cesium · GitHub, which improves the way we handle memory limits. You can try it by downloading and building Cesium from the latest main branch on GitHub.

Which refinement type is your tileset using? If it is using additive refinement, and one individual building is already too big to fit in memory, then it is possible that the zoom level that shows that building will always overflow the memory.

Are you able to share a Sandcastle link demonstrating the problem?

Hi,

I’ll try out the latest branch and update the findings here.

My tileset is using the replace refinement type.

For reference, one tileset is approximately built from 6gb of 3D assets (approximately 800 buildings). We are hoping to load more tilesets of varying number of buildings but currently already facing issue loading tileset of the above said size. Also we’re trying to view from zoom 9 (trying to show all of the 800 buildings in a view). Hopefully these gives a better description of my current setup.

I’ve tried using the settings for cacheBytes and maximumCacheOverflowBytes from the link you have suggested. However it is still currently crashing. I suspect this does not work because the 800 buildings are tiled as one singular tileset.
Is it the issue of my tileset or how can I tweak these settings to more reliably load large areas of buildings.

Hi @Rhea, thanks for the update. I expect the issue is in the way the data is tiled.

A large number of buildings should not be a problem for 3D Tiles, since the geometry is simplified when you are zoomed out to see many of them at once. The geometry loaded for a given camera position only needs to be accurate enough for the errors to be less than one pixel on your screen. This level of accuracy should require much less than the total 6GB.

How are you tiling the data? Are you using Cesium’s tilers?

I’m using my own tilers but currently all 800 buildings are tiled as a single tile. Is that the issue?
Mainly this is to reduce tiling time.

Hi @Rhea, 800 buildings in the tile used for zoomed-out views should not be a problem, because in that case they will be rendered at a lower resolution.

When zoomed in to see details, only the buildings near the camera need to be rendered in high resolution. (The buildings far away from the camera can still be rendered at low resolution.) This means the higher-resolution layers need to consist of a large number of tiles, so the renderer can choose a small subset for rendering.

For an explanation of how Cesium uses different levels of detail for rendering, see the 3DTiles Reference Card, especially sections 5, 6, and 7.