+1 vote

Hey,
in my game I want test lowering the 3d resolution to improve performance as stated in the docs:

If Stretch Mode is set to something other than Disabled, the size of
the root viewport is scaled down by the Shrink factor, and pixels in
the output are scaled up by the same amount. This is rarely useful for
2D games, but can be used to increase performance in 3D games by
rendering them at a lower resolution.

https://docs.godotengine.org/de/stable/tutorials/viewports/multiple_resolutions.html#stretch-shrink
This is e.g. how my main menu in the game looks like:
enter image description here
I've set my stretch mode to "2d" and the aspect to "expand" in the project settings, which is working fine.
Now I want the 3d resolution to be lowered. When I set the shrink value up, my 3d render resolution is correctly lowered, but my ui is messed up:
enter image description here

How can I achieve the lower 3d resolution without scaling the ui?

in Engine by (178 points)

1 Answer

0 votes

How can I achieve the lower 3d resolution without scaling the ui?

You need to use two viewports. This means you'll need to create one Viewport node, as Godot will automatically create a viewport for you (it's often called the "root viewport").

The root viewport will render 2D elements, whereas the Viewport node will render the 3D scene. This way, the Viewport node can have its resolution decreased without affecting 2D elements.

There is a demo that showcases this here: https://github.com/godotengine/godot-demo-projects/tree/master/viewport/3d_scaling

by (9,272 points)
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 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 webmaster@godotengine.org with your username.