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

Vulkan: RenderingServer.texture_set_shrink_all_x2_on_set_data() not reimplemented yet #43276

Open
Calinou opened this issue Nov 2, 2020 · 1 comment

Comments

@Calinou
Copy link
Member

Calinou commented Nov 2, 2020

Godot version: Git be14d9d

OS/device including version: Fedora 33

Issue description:

RenderingServer.texture_set_shrink_all_x2_on_set_data() is not reimplemented yet. For those wondering, this is a method that shrinks all loaded textures by a 2× factor. This can be used to reduce aliasing on downsampling while lowering memory usage (unlike enabling mipmaps, which will increase memory usage).

For 3D, perhaps an upcoming texture streaming API will be a better replacement to this method, but we should probably have some kind of replacement in 4.0 anyway. The current method doesn't offer any control over which textures will be downscaled, which can be problematic for 3D games or games where you want to keep UI elements sharp at all times.

@k8035
Copy link

k8035 commented Oct 15, 2022

Suggestion: RenderingServer.texture_set_shrink_all_x2_on_set_data() should be renamed to RenderingServer.texture_set_shrink_all_on_set_data(scale) and receive the scale factor as a parameter, so the developer can use other scale factors than 0.5.

Use case:

  • A crisp 2D UI where the texture sizes of the elements should be close to their size on the screen, where the screen resolution can range from 1280x720 to 3840x2160 and above.
  • The project base size is set to 3840x2160 and the original texture sizes target this resolution. On lower resolutions, the UI should be a) crisp and b) not waste texture memory due to unnecessarily large textures.
  • The developer implements some code to check for the current window resolution before loading the UI textures, and to set the texture scale factor accordingly.
  • If it's 3840x2160 and above, the code will set the texture scale factor to 1.
  • If it's 2880x1620 and above, the code will set the texture scale factor to 0.75.
  • If it's 1920x1080 and above, the code will set the texture scale factor to 0.5.
  • If it's 1280x720 and above, the code will set the texture scale factor to 0.3333.
  • The command influences the scale factor of all textures that are loaded afterwards, until the command is run again with a different scale factor. This way the developer can use different scale factors for the UI (depending on the current window resolution) and for the game world (depending on a player-configurable texture detail setting).

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