KSPModdingLibs / KSPCommunityFixes

Community patches for bugs in the KSP codebase
49 stars 17 forks source link

On-demand part textures #227

Open gotmachine opened 3 months ago

gotmachine commented 3 months ago

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.

gotmachine commented 3 months ago

Current prototype implementation :

This (very incomplete) prototype has shed some light on a few problems :

Some general remarks, in no particular order :