Skip to content

Commit c2f173c

Browse files
authored
Add a page on 3D resolution scaling (#6331)
1 parent 87754ee commit c2f173c

7 files changed

+240
-0
lines changed
Loading
Loading
Loading
Loading
Loading

tutorials/3d/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
baked_lightmaps
1717
environment_and_post_processing
1818
3d_antialiasing
19+
resolution_scaling
1920
volumetric_fog
2021
high_dynamic_range
2122
using_gridmaps

tutorials/3d/resolution_scaling.rst

Lines changed: 239 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,239 @@
1+
Resolution scaling
2+
==================
3+
4+
Why use resolution scaling?
5+
---------------------------
6+
7+
With the ever-increasing rendering complexity of modern games, rendering at
8+
native resolution isn't always viable anymore, especially on lower-end GPUs.
9+
10+
Resolution scaling is one of the most direct ways to influence the GPU
11+
requirements of a scene. In scenes that are bottlenecked by the GPU (rather than
12+
by the CPU), decreasing the resolution scale can improve performance
13+
significantly. Resolution scaling is particularly important on mobile GPUs where
14+
performance and power budgets are limited.
15+
16+
While resolution scaling is an important tool to have, remember that resolution
17+
scaling is not intended to be a replacement for decreasing graphics settings on
18+
lower-end hardware. Consider exposing both resolution scale and graphics
19+
settings in your in-game menus.
20+
21+
.. note::
22+
23+
Resolution scaling is currently not available for 2D rendering, but it can be
24+
simulated using the ``viewport`` stretch mode. See :ref:`doc_multiple_resolutions`
25+
for more information.
26+
27+
Resolution scaling options
28+
--------------------------
29+
30+
In the advanced Project Settings' **Rendering > Scaling 3D** section, you cany
31+
find several options for 3D resolution scaling:
32+
33+
Scaling mode
34+
^^^^^^^^^^^^
35+
36+
- **Bilinear:** Standard bilinear filtering (default).
37+
- **FSR 1.0:** `AMD FidelityFX Super Resolution 1.0 <https://gpuopen.com/fidelityfx-superresolution/>`__.
38+
Slower, but higher quality compared to bilinear scaling. On very slow GPUs,
39+
the cost of FSR 1.0 may be too expensive to be worth using it over bilinear
40+
scaling.
41+
42+
Here are comparison images between native resolution, bilinear scaling with 50%
43+
resolution scale and FSR 1.0 scaling with 50% resolution scale:
44+
45+
.. image:: img/resolution_scaling_bilinear_0.5.png
46+
47+
.. image:: img/resolution_scaling_fsr1_0.5.png
48+
49+
FSR 1.0 upscaling works best when coupled with another form of antialiasing.
50+
Temporal antialiasing (TAA) or multisample antialiasing (MSAA) should preferably
51+
be used in this case, as FXAA does not add temporal information and introduces
52+
more blurring to the image.
53+
54+
Here's the same comparison, but with 4× MSAA enabled on all images:
55+
56+
.. image:: img/resolution_scaling_bilinear_msaa_4x_0.5.png
57+
58+
.. image:: img/resolution_scaling_fsr1_msaa_4x_0.5.png
59+
60+
Notice how the edge upscaling of FSR 1.0 becomes much more convincing once 4×
61+
MSAA is enabled.
62+
63+
Rendering scale
64+
^^^^^^^^^^^^^^^
65+
66+
The **Rendering > Scaling 3D > Scale** setting adjusts the resolution scale.
67+
``1.0`` represents the full resolution scale, with the 3D rendering resolution
68+
matching the 2D rendering resolution. Resolution scales *below* ``1.0`` can be
69+
used to speed up rendering, at the cost of a blurrier final image and more aliasing.
70+
71+
The rendering scale can be adjusted at run-time by changing the ``scaling_3d_scale``
72+
property on a :ref:`class_Viewport` node.
73+
74+
Resolution scales *above* ``1.0`` can be used for supersample antialiasing
75+
(SSAA). This will provide antialiasing at a *very* high performance cost, and is
76+
**not recommended** for most use cases. See :ref:`doc_3d_antialiasing` for more
77+
information.
78+
79+
The tables below list common screen resolutions, the resulting 3D rendering
80+
resolution and the number of megapixels that need to be rendered each frame
81+
depending on the rendering scale option. Rows are sorted from fastest to slowest
82+
in each table.
83+
84+
.. note::
85+
86+
The resolution scale is defined on a **per-axis** basis. For example, this
87+
means that halving the resolution scale factor will reduce the number of
88+
rendered megapixels per frame by a factor of 4, not 2. Therefore, very low
89+
or very high resolution scale factors can have a greater performance impact
90+
than expected.
91+
92+
**1920×1080 (Full HD)**
93+
94+
+--------------------------+-------------------------+-------------------------------+
95+
| Resolution scale factor | 3D rendering resolution | Megapixels rendered per frame |
96+
+==========================+=========================+===============================+
97+
| ``0.50`` | 960×540 | 0.52 MPix |
98+
+--------------------------+-------------------------+-------------------------------+
99+
| ``0.67`` | 1286×723 | 0.93 MPix |
100+
+--------------------------+-------------------------+-------------------------------+
101+
| ``0.75`` | 1440×810 | 1.17 MPix |
102+
+--------------------------+-------------------------+-------------------------------+
103+
| ``0.85`` | 1632×918 | 1.50 MPix |
104+
+--------------------------+-------------------------+-------------------------------+
105+
| ``1.00`` **(native)** | **1920×1080** | **2.07 MPix** |
106+
+--------------------------+-------------------------+-------------------------------+
107+
| ``1.33`` (supersampling) | 2553×1436 | 3.67 MPix |
108+
+--------------------------+-------------------------+-------------------------------+
109+
| ``1.50`` (supersampling) | 2880×1620 | 4.67 MPix |
110+
+--------------------------+-------------------------+-------------------------------+
111+
| ``2.00`` (supersampling) | 3840×2160 | 8.29 MPix |
112+
+--------------------------+-------------------------+-------------------------------+
113+
114+
**2560×1440 (QHD)**
115+
116+
+--------------------------+-------------------------+-------------------------------+
117+
| Resolution scale factor | 3D rendering resolution | Megapixels rendered per frame |
118+
+==========================+=========================+===============================+
119+
| ``0.50`` | 1280×720 | 0.92 MPix |
120+
+--------------------------+-------------------------+-------------------------------+
121+
| ``0.67`` | 1715×964 | 1.65 MPix |
122+
+--------------------------+-------------------------+-------------------------------+
123+
| ``0.75`` | 1920×1080 | 2.07 MPix |
124+
+--------------------------+-------------------------+-------------------------------+
125+
| ``0.85`` | 2176×1224 | 2.66 MPix |
126+
+--------------------------+-------------------------+-------------------------------+
127+
| ``1.00`` **(native)** | **2560×1440** | **3.69 MPix** |
128+
+--------------------------+-------------------------+-------------------------------+
129+
| ``1.33`` (supersampling) | 3404×1915 | 6.52 MPix |
130+
+--------------------------+-------------------------+-------------------------------+
131+
| ``1.50`` (supersampling) | 3840×2160 | 8.29 MPix |
132+
+--------------------------+-------------------------+-------------------------------+
133+
| ``2.00`` (supersampling) | 5120×2880 | 14.75 MPix |
134+
+--------------------------+-------------------------+-------------------------------+
135+
136+
**3840×2160 (Ultra HD "4K")**
137+
138+
+--------------------------+-------------------------+-------------------------------+
139+
| Resolution scale factor | 3D rendering resolution | Megapixels rendered per frame |
140+
+==========================+=========================+===============================+
141+
| ``0.50`` | 1920×1080 | 2.07 MPix |
142+
+--------------------------+-------------------------+-------------------------------+
143+
| ``0.67`` | 2572×1447 | 3.72 MPix |
144+
+--------------------------+-------------------------+-------------------------------+
145+
| ``0.75`` | 2880×1620 | 4.67 MPix |
146+
+--------------------------+-------------------------+-------------------------------+
147+
| ``0.85`` | 3264×1836 | 5.99 MPix |
148+
+--------------------------+-------------------------+-------------------------------+
149+
| ``1.00`` **(native)** | **3840×2160** | **8.29 MPix** |
150+
+--------------------------+-------------------------+-------------------------------+
151+
| ``1.33`` (supersampling) | 5107×2872 | 14.67 MPix |
152+
+--------------------------+-------------------------+-------------------------------+
153+
| ``1.50`` (supersampling) | 5760×3240 | 18.66 MPix |
154+
+--------------------------+-------------------------+-------------------------------+
155+
| ``2.00`` (supersampling) | 7680×4320 | 33.18 MPix |
156+
+--------------------------+-------------------------+-------------------------------+
157+
158+
FSR Sharpness
159+
^^^^^^^^^^^^^
160+
161+
When using the FSR 1.0 scaling mode, the sharpness can be controlled using the
162+
**Rendering > Scaling 3D > FSR Sharpness** advanced project setting.
163+
164+
The intensity is inverted compared to most other sharpness sliders: *lower*
165+
values will result in a sharper final image, while *higher* values will *reduce*
166+
the impact of the sharpening filter. ``0.0`` is the sharpest, while ``2.0`` is
167+
the least sharp. The default value of ``0.2`` provides a balance between
168+
preserving the original image's sharpness and avoiding additional aliasing due
169+
to oversharpening.
170+
171+
.. note::
172+
173+
If you wish to use sharpening when rendering at native resolution, Godot
174+
currently doesn't allow using the sharpening component of FSR (RCAS)
175+
independently from the upscaling component (EASU).
176+
177+
As a workaround, you can set the 3D rendering scale to ``0.99``, set the
178+
scaling mode to **FSR 1.0** then adjust FSR sharpness as needed. This allows
179+
using FSR 1.0 while rendering at a near-native resolution.
180+
181+
Mipmap bias
182+
^^^^^^^^^^^
183+
184+
Godot automatically uses a negative texture mipmap bias when the 3D resolution
185+
scale is set below ``1.0``. This allows for better preservation of texture
186+
detail at the cost of a grainy appearance on detailed textures.
187+
188+
The texture LOD bias currently affects both 2D and 3D rendering in the same way.
189+
However, keep in mind it only has an effect on textures with mipmaps enabled.
190+
Textures used in 2D don't have mipmaps enabled by default, which means only 3D
191+
rendering is affected unless you enabled mipmaps on 2D textures in the Import
192+
dock.
193+
194+
The formula used to determine the texture mipmap bias is: TODO
195+
196+
To counteract the blurriness added by some antialiasing methods, Godot also adds
197+
a ``-0.25`` offset when FXAA is enabled, and a ``-0.5`` offset when TAA is
198+
enabled. If both are enabled at the same time, a ``-0.75`` offset is used. This
199+
mipmap bias offset is applied *before* the resolution scaling offset, so it does
200+
not change depending on resolution scale.
201+
202+
The texture LOD bias can manually be changed by adjusting the **Rendering >
203+
Textures > Default Filters > Texture Mipmap Bias** advanced project setting. It
204+
can also be changed at run-time on :ref:`Viewports <class_Viewport>` by
205+
adjusting the ``texture_mipmap_bias`` property.
206+
207+
.. warning::
208+
209+
Adjusting the mipmap LOD bias manually can be useful in certain scenarios,
210+
but this should be done carefully to prevent the final image from looking
211+
grainy in motion.
212+
213+
*Negative* mipmap LOD bias can also decrease performance due to
214+
higher-resolution mips having to be sampled further away. Recommended values
215+
for a manual offset are between ``-0.5`` and ``0.0``.
216+
217+
*Positive* mipmap LOD bias will make mipmapped textures appear blurrier than
218+
intended. This may improve performance slightly, but is otherwise not
219+
recommended as the loss in visual quality is usually not worth the
220+
performance gain.
221+
222+
The example below shows an extreme case, with a mipmap LOD bias of ``-1.0`` and
223+
anisotropic filtering disabled to make the difference more noticeable:
224+
225+
.. image:: img/resolution_scaling_texture_mipmap_bias_comparison.png
226+
227+
Troubleshooting
228+
---------------
229+
230+
Performance does not increase much when decreasing resolution scale
231+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
232+
233+
If performance doesn't increase much when decreasing resolution scale to a value
234+
like ``0.5``, it likely means the performance bottleneck is elsewhere in your
235+
scene. For example, your scene could have too many draw calls, causing a CPU
236+
bottleneck to occur. Likewise, you may have too many graphics effects enabled
237+
for your GPU to handle (such as SDFGI, SSAO or SSR).
238+
239+
See the :ref:`doc_performance` tutorials for more information.

0 commit comments

Comments
 (0)