On-demand part textures#227
Conversation
|
Current prototype implementation :
This (very incomplete) prototype has shed some light on a few problems :
Some general remarks, in no particular order :
|
|
So as part of my work with KSPTextureLoader I have become rather familiar with building asset bundles at runtime and I think that ability gives us a much better way to go about this. If we only move two things to be loaded from asset bundles we can actually directly turn on unity's existing mipmap streaming feature, which gives us exactly what we want without needing to figure out which renderers refer to which textures or when we need to actually load/unload them. To make this work we need 3 parts:
A middle ground might be to enable streaming on textures and then manually track which parts are active and set the requested mipmap level ourselves. We'd need to track textures by part and I expect this to be somewhat difficult to make work well. |
This is exploratory work for implementing an on-demand loading mechanism for part textures.
The general idea would be identify which textures are used in parts prior to loading them, then to skip loading them during initial game load, to finally load them selectively and asynchronously when a part is effectively instantiated in game. Textures would then be unloaded when no instantiated part is using them anymore.
The potential benefits would be :
However, the caveats are numerous :
On a side note, I'm not sure I will have the time nor motivation to get this idea to completion. But at least whatever I do will be a base for anyone wanting to pursue this project.
[*] A stretch goal could be to replace the stock cargo/inventory static thumbnails by 3D models with downscaled textures. The stock static thumbnail system generate a 256x256 texture for every part and every variant of every part, which ends up being a significant waste of VRAM. At the very least, the resolution of those thumbs should be reduced, 128x128 would be more than enough given that at 100% UI scale, the viewport for a part is 64x64.