Resizing textures before load on the fly?

Godot Version

4.5

Question

In 3D games, usually they shipped multiple sizes of texture files and you can choose which texture size to play with. Obviously, the higher texture size requires more vram. But having all of these texture files of many resolutions sure take a lot of spaces.

So instead of having variety of texture sizes, is it feasible to just ship 1 texture size, the largest? Then, when the game is about to load the textures, have Godot resize the texture if on lower texture setting on the fly before loading them in?

This should reduce the required space of the textures, but loading textures will now be a bit slower for those who play on lower textures setting. Still, it shouldn’t be that slow unless there are so many textures to resize.

So is it possible to do this in Godot and is this feasible?

You can load textures as images and use Image’s shrink_x2() function until it matches the lesser resolution, then convert the image into a ImageTexture. Though this is much more work than using load, maybe you could pre-compute the lower texture sizes before shipping as part of a editor script, then you can still use load with a path format that allows for easy texture resolution selection, like “res://tex/2048/dirt.dds” and “res://tex/1024/dirt.dds”

@gertkeno if that’s really it, then, I just need to implement Autoloader to manage what you mentioned. It doesn’t sound like a lot more work, does it? Just a few function calls unless I am missing something?

Just a different way to load I suppose. You may have to mark your textures to import as “Image” instead of any of the texture formats.