Automatic generation of texture resolution variants #14011
Replies: 1 comment 1 reply
-
|
I believe #10034 is very similar, although the exact use case is different (it's not specifically designed with HD texture packs in mind). That said, this use case should remain possible with #10034.
To be fair, most 2D games aren't that large in terms of disk space or VRAM utilization. Also, the number of displays with a resolution above 1080p is expected to increase significantly in the next few years, so shipping 4K-ready textures will pay off in the long term 🙂 Personally, I think this use case makes more sense for 3D games where it can be the difference between a 20 GB installation and a 70+ GB installation. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I noticed that the documentation recommends using 4K textures with mipmaps for 2D, which sounds extremely inefficient. For FHD users, texture sizes increase sixfold to benefit only a small number of 4K users (~5% according to Steam).
I’ve already seen suggestions to override textures via
.pckpatches, and I believe the engine already has everything needed to support this. However, there are several issues that make this approach impractical:Expand Mode: Keep Sizeand manually set the minimum size for every single texture.This looks like a headache, but it should work out of the box.
Proposed solution:
Settings
Add Texture Variants to Project Settings / Globals, representing a set of presets, for example:
The resolution marked as native should be used in the editor, and its textures should be included in the main game
.pck.For each other resolution, a corresponding patch (e.g. "res://ui_qhd.pck") should be generated during export a project.
Texture2D import changes
Add a variant option to the Texture2D import settings (disabled by default). When a variant name (e.g. ui / game) is chosen, the following sub-options become available:
Variant resolution - defaults to native
Src textures for other resolutions
If not specified:
for resolutions with a smaller scale, a smaller texture will be generated (similar to
Size Limit)for resolutions with a larger scale, the original texture will be used unchanged
A crucial part of the import process should be storing the native texture size in Texture2D, which would be used by
Expand Mode: Keep Size.For example, for a native 4K-variant where the texture is 128×128, nothing changes. However, if an FHD-variant patch is loaded, a 64×64 texture should still be treated by TextureRect as 128×128 in order to preserve the layout.
The only thing left for the developer is to load the required patches manually at game startup.
Beta Was this translation helpful? Give feedback.
All reactions