godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.07k stars 69 forks source link

Support scaled versions of imported textures based on use #10010

Open LuciferTheAngel opened 1 week ago

LuciferTheAngel commented 1 week ago

Describe the project you are working on

Platformer games like Cuphead and Rayman Legend, which look as if they are moving pictures drawn on a high-definition monitor.

Describe the problem or limitation you are having in your project

When we actually loaded large images into the Godot Engine, put them straight into the editor and scaled them down to a size that would fit on the screen, and test-played them, we found that depending on the number of images, the loading time from start-up to the game screen can be quite long.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

After importing each image, we would like to be able to automatically compress it and display the compressed results through a screen like this. unity

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

When you drag and drop a large image (e.g. a 1600 x 400px image as a 1024 x 256px image), it is automatically compressed.

If this enhancement will not be used often, can it be worked around with a few lines of script?

An editor plug-in can solve this problem, but if there is no internet connection, it will not be possible to install the plug-in, and people who have made games with large images in Unity should be able to make them in the same way as in Unity.

Is there a reason why this should be core and not an add-on in the asset library?

Because loading large images can reduce the loading time of the test play.

AThousandShips commented 1 week ago

An editor plug-in can solve this problem, but if there is no internet connection, it will not be possible to install the plug-in

How would you get your hands on Godot without an internet connection? Or update your version?

Also there's already the "size limit" setting when importing textures, does that not suit your needs?

LuciferTheAngel commented 1 week ago

As for the no internet connection thing, this is after installing Godot. Also, if you only limit the size, you will have to attach image files with the pixels as they are.

Calinou commented 1 week ago

This is already available in both 3.x and 4.x with the Size Limit import option.

AThousandShips commented 1 week ago

Are you not talking about importing images scaled down? If you aren't please describe the feature a bit more clearly, I'm not sure what you mean and I don't use Unity so I don't know how that feature works

LuciferTheAngel commented 1 week ago

It does not take away about importing scaled-down images. What I am saying is that after each image is imported, it should be automatically compressed and the compressed result can be displayed through a screen like this. unity

AThousandShips commented 1 week ago

Please update your proposal description to reflect this in more detail

LuciferTheAngel commented 1 week ago

For more information about Texture's Import Setting, read the page at the following URL.

https://docs.unity3d.com/2022.3/Documentation/Manual/class-TextureImporter.html

Calinou commented 1 week ago

What I am saying is that after each image is imported, it should be automatically compressed and the compressed result can be displayed through a screen like this.

VRAM compression is already automatically used for textures that are detected to be used in 3D. The issue is that VRAM compression looks bad when used in 2D, so it's not automatically enabled on large textures used in 2D.

clayjohn commented 1 week ago

@allenwp And I were discussing this earlier. We should have some sort of solution for automatically downscaling texture assets. We haven't arrived at a solid proposal yet, but Allen is working on it.

We made a number of notable conclusions:

  1. The engine should only export the chosen size (so you don't bloat the game file size and you reduce load times)
  2. You should have the ability to specify a size/scale per platform
  3. Ideally the textures would be resized at export time so you don't bloat import times during development
  4. You need a way to quickly change most textures in a project (e.g. for porting a game to a new platform, you don't want to manually go through each texture one by one to setup a new scaling option)
allenwp commented 1 week ago

Existing discussion is here.

I planned to put up my proposal on this feature this month and I think I can still hit that timeframe.

allenwp commented 1 week ago

@LuciferTheAngel if the Limit Size import parameter is not suitable, I just finished putting together a proposal with quite a lot of detail to it that you might be interested in: #10034

Specifically, the “Add Scale Factor Texture2D import parameter as an alternative to Size Limit” might be the sort of feature you were looking for. It’s described around two thirds of the way through proposal under the heading “Part 2: Texture2D Scale Factor”.