![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | st_phan |
Question:
If my game should look crisp in 4K as well as lower resolutions – ignoring future resolutions for now – must I set the base resolution to 4K?
(Context and research below)
Context:
I am working on a non-pixel 2D game
Research done:
I read through the article “Multiple resolutions”, the FAQ “How should assets be created to handle multiple resolutions and aspect ratios?” as well as multiple questions on the topic of “upscaling”, “responsiveness”, etc.
Test:
- I have an asset in 4K (3840 × 2160)
- To emphasize the “problem” I set the base resolution to 640 × 360
- The asset is scaled in game using transform to fit the viewport
- HiDPI mode is turned on
- Stretch mode is set to viewport
- → Outcome when fullscreening the window: Rendering is pixelated (likely 640 × 360 is stretched to cover the whole screen)
Approaches outside Godot: Web
In web development it’s common to provide assets in various sizes and the browser picks the appropriate one (it’s called srcset and basically means old devices load an image in smaller resolution than devices with hidpi screen).
→ There doesn’t seem to something like that in Godot
Approaches outside Godot: Android
On Android there is the unit “DP” which is called density-independent pixel which makes it easy to make things essentially the same size depending no the pixel density of the screen. (A browser does essentially the same but still calls it “px” which can be confusing).
Example:
- 1 DP on a FullHD 1920 × 1080 screen (with pixel density @1x) = 1px
- 1 DP on a 4K 3840 × 2016 screen (with pixel density @2x) = 2px
→ Godot doesn’t seem to work with DP
Understanding:
It seems to me that “base resolution” is basically the game’s “maximum resolution” or “render resolution” and then scaled up or down depending on the device’s resolution (possibly with performance optimizations when scaling down).
I am not 100% sure, but it seems that stretch-mode “canvas_items” (formerly called 2D) does the trick (image looks crisp despite base resolution being much smaller than 4K):
This means that everything is rendered directly at the target
resolution
st_phan | 2023-04-11 09:28