-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Shared identical external textures from GLB files are not accounted for in resource statistics #11897
Comments
CC CesiumGS/cesium-native#497 |
@kring Others may have to confirm this, but I also thought that this was supposed to be implemented. I tested it, inspired by the forum post at https://community.cesium.com/t/how-does-cesiumjs-manage-textures-shared-across-tiles/30404/2 , and it looks like it is not working as expected. But note the NOTE that I edited in: It might be that CesiumJS is actually doing the texture sharing, and it is only the "memory tracking" functionality that does not properly take this into account, and assumes that the tiles need more memory than they actually need. (I think there's no really easy way to confirm that - e.g. something like the "Windows Task Manager - GPU memory" overview might not really be accurate enough here...) |
You can run renderdoc with chrome and see the allocated textures; see e.g. https://edw.is/renderdoc-webgl/ . I don't know if there are more integrated tools than that. |
An update: It now looks like the textures are shared, but only the mechanism for computing the "total memory usage" is flawed by not taking this into account, and causes tiles (unnecessarily) to be omitted. The issue text has been updated accordingly. |
I had a short look at how this could be addressed. Some context - people might want to skip this if they already have a mental model of all that...:
Now, there are two parts to this problem. The (maybe) simpler one is identifying identical textures. Each The more difficult question is: How to handle these IDs and the size, globally for the whole tileset? The information about the textures and their sizes has to be stored and maintained on the level of the tileset. This would probably reside in the This mapping has to be updated when tiles are loaded/unloaded. And right now, the update of the statistics is solely happening based on the information that is provided by a I'll think about some options, and maybe try out a few things, but maybe someone already has a strong preference for one approach here. |
This came up in the forum, as the underlying reason for https://community.cesium.com/t/implicit-tiling-inconsistency-with-vs-without-textures/34640 |
EDIT: This issue originally claimed that external textures that are referred to from multiple GLB files are not shared internally. A pragmatic logging statement in the
GltfImageLoader
class suggests that the textures are shared, and actually only loaded once. But loading such an asset still causes undesired behavior, with the details updated below accordingly.The following archive contains test data for this, namely a tileset and a simple Sandcastle for loading it:
ExternalTextureSharing-2024-03-25.zip
The tileset consists of a simple
tileset.json
that refers to 100 GLB files. These GLB files each contain trivial geometry (a unit square, two triangles). All these 100 GLB files refer to only two external textures (that are stored outside of the GLB, and referred to, from the GLBs, via their URI). These are PNG files with 2048x2048 pixels.So the whole tileset cotains two 2k-textures and a few bytes of geometry data, but when more tiles are loaded, it bails out with the message
and starts omitting some tiles:
After a short investigation, it turns out that the external textures indeed are loaded only once. But the mechanism for computing the memory usage does not take this into account. The
ModelStatistics
are accumulating the data for each model, and reporting the total size as thetotalMemoryUsageBytes
, which eventually triggers the message about the exceeded memory.The text was updated successfully, but these errors were encountered: