The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

+8 votes

I would like my game to look sharp on mobile devices(tablets, 3.5Inch to 10inch)

So I looked at this tutorial:

I don't get which Stretch Mode I should use. When should I use 2D and when Viewport?

I really just want sharp asstes on the devices.

in Engine by (107 points)
edited by

2 Answers

+8 votes

I really just want sharp assets on all devices.

Your best bet is using the disabled scaling mode, and using high-resolution assets (since Godot does not support vectors directly, like SVG).

A good bet is using assets that have 2× higher resolution than needed on typical screens (eg. if a sprite covers a 64x64 area in the project, then import a 128x128 image), although it still won't be enough for screens with extremely high DPI (some devices can reach over 500 DPI!). If you design your sprites using vector software, it is very easy to export high-resolution versions.

That said, here's the difference between disabled, 2d and viewport scaling modes:

  • disabled: while the framebuffer will be resized to match the game window, nothing will be upscaled or downscaled (this includes GUIs).
  • 2d: the framebuffer is still resized, but GUIs can be upscaled or downscaled. This can result in blurry or pixelated fonts.
  • viewport: the framebuffer is resized, but computed at the original size of the project. The whole rendering will be pixelated. You generally do not want this, unless it's part of the game style.
by (12,878 points)

I modified my question. I want it to look good on all mobile devices, because for desktop I will make a different version of the game.

So for how many resolutions should I then export the asstes from my vector program, if I target (only) mobile devices?

As I said, you can just use really high-resolution images and it'll look good anywhere, but it won't be efficient on low-DPI devices (which are not that common in the mobile space today).

Godot is able to lower image resolution on export, but I haven't dived into that yet.

+6 votes

Scaling is a nightmare, scary stuff. I've been trying to tackle scaling to different aspect ratios with no avail, I don't think it can ever be perfect. But my most recent achievement is to disable stretching and instead adjust the zoom level of a camera based on the size of the viewport (aka resolution of the game window). Although this was only intended for side scrolling games, it sounds like it should also be fine for non-moving camera games. More details here: reddit post

by (855 points)

Thanks for this. Although I haven't yet tested this particular solution, I have found many of your posts and code snippets on Godot QA and Reddit to be very helpful.

Thanks, I'm still learning and hope to contribute back to the Godot community as best as I can :)

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.