resolution_scaling.rst 13 KB

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