Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding options to godot's downscaling/downsampling #4586

Closed
rageboi1011 opened this issue May 24, 2022 · 2 comments
Closed

Adding options to godot's downscaling/downsampling #4586

rageboi1011 opened this issue May 24, 2022 · 2 comments

Comments

@rageboi1011
Copy link

Describe the project you are working on

Godot can downscale textures perfectly fine, but when you change the window's size while using keep in the window stretch settings, everything gets pixelated. Most likely this is because Godot uses something like nearest neighbour to downscale the window's contents, instead of something like bicubic scaling.

image

Describe the problem or limitation you are having in your project

Both of my current projects are mainly UI based and it's really bugging me how they look janky when they're windowed

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

I'd like to ask for a way to change this downscaling from whatever Godot is currently using, to bicubic for example.

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

I don't think this needs any further explanation.

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

Possibly, if someone were to not use keep and viewport in the window stretch options and instead scale stuff according to the window's size using a camera or something, but I feel like it should be a default option.

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

People shouldn't have to look for a feature that can be so essential for making your UI look nice.

@Calinou
Copy link
Member

Calinou commented May 24, 2022

Duplicate of #1467.

That said, I don't think you actually need this feature to resolve this issue in your project. It's a matter of using the project settings that best match your use case.

If you use the 2d stretch mode, Godot will upscale/downscale 2D elements but will render them at a resolution matching the window size. Textures will be scaled with bilinear filtering if filtering is enabled on them (which is the default), or nearest-neighbor filtering if filtering is disabled on them.

In contrast, if you use the viewport stretch mode and resize the window to a resolution lower than the base resolution configured in the project settings, Godot will render at a higher resolution than actually needed. This generally wastes CPU/GPU resources in most situations, which is a bad idea for non-game applications (think of laptops' battery life).

To summarize, do not use the viewport stretch mode for non-game applications. The viewport stretch mode is primarily intended to be used for games with a pixel art aesthetic. In fact, for non-game applications, 2d isn't ideal either as it applies an automatically determined scale factor (in relation to the default window size). For applications, you probably want to use the disabled stretch mode to get more control over the scale factor.

You may also want to reconsider the use of the keep stretch mode for a non-game application (since it disables support for multiple aspect ratios), but that's a subject for another day 🙂

See Common use case scenarios in the Multiple resolutions documentation for more recommendations.

@Calinou Calinou added archived and removed topic:2d labels May 24, 2022
@rageboi1011
Copy link
Author

Oh wow I did not expect a reply this fast. Thanks for the advice dude 👍

@Calinou Calinou closed this as not planned Won't fix, can't repro, duplicate, stale May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants