importing_images.rst 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. .. _doc_importing_images:
  2. Importing images
  3. ================
  4. Supported image formats
  5. -----------------------
  6. Godot can import the following image formats:
  7. - BMP (``.bmp``)
  8. - No support for 16-bit per pixel images. Only 1-bit, 4-bit, 8-bit, 24-bit, and 32-bit per pixel images are supported.
  9. - DirectDraw Surface (``.dds``)
  10. - If mipmaps are present in the texture, they will be loaded directly.
  11. This can be used to achieve effects using custom mipmaps.
  12. - OpenEXR (``.exr``)
  13. - Supports HDR (highly recommended for panorama skies).
  14. - Radiance HDR (``.hdr``)
  15. - Supports HDR (highly recommended for panorama skies).
  16. - JPEG (``.jpg``, ``.jpeg``)
  17. - Doesn't support transparency per the format's limitations.
  18. - PNG (``.png``)
  19. - Precision is limited to 8 bits per channel upon importing (no HDR images).
  20. - Truevision Targa (``.tga``)
  21. - SVG (``.svg``, ``.svgz``)
  22. - SVGs are rasterized using `ThorVG <https://www.thorvg.org/>`__
  23. when importing them. Support is limited; complex vectors may not render correctly.
  24. You can check whether ThorVG can render a certain vector correctly using its
  25. `web-based viewer <https://www.thorvg.org/viewer>`__.
  26. For complex vectors, rendering them to PNGs using `Inkscape <https://inkscape.org/>`__
  27. is often a better solution. This can be automated thanks to its
  28. `command-line interface <https://wiki.inkscape.org/wiki/index.php/Using_the_Command_Line#Export_files>`__.
  29. - WebP (``.webp``)
  30. - WebP files support transparency and can be compressed lossily or losslessly.
  31. The precision is limited to 8 bits per channel.
  32. .. note::
  33. If you've compiled the Godot editor from source with specific modules disabled,
  34. some formats may not be available.
  35. Importing textures
  36. ------------------
  37. The default action in Godot is to import images as textures. Textures are stored
  38. in video memory. Their pixel data can't be accessed directly from the CPU
  39. without converting them back to an :ref:`class_Image` in a script. This is what
  40. makes drawing them efficient.
  41. There are over a dozen import options that can be adjusted after selecting an
  42. image in the FileSystem dock:
  43. .. figure:: img/importing_images_import_dock.webp
  44. :align: center
  45. :alt: Import options in the Import dock after selecting an image in the FileSystem dock
  46. Import options in the Import dock after selecting an image in the FileSystem dock.
  47. Some of these options are only visible with certain compression modes.
  48. .. _doc_importing_images_changing_import_type:
  49. Changing import type
  50. ^^^^^^^^^^^^^^^^^^^^
  51. It is possible to choose other types of imported resources in the Import dock:
  52. - **BitMap:** 1-bit monochrome texture (intended to be used as a click mask in
  53. :ref:`class_TextureButton` and :ref:`class_TouchScreenButton`). This resource
  54. type cannot be displayed directly onto 2D or 3D nodes, but the pixel values
  55. can be queried from a script using :ref:`get_bit
  56. <class_BitMap_method_get_bit>`.
  57. - **Cubemap:** Import the texture as a 6-sided cubemap, with interpolation
  58. between the cubemap's sides (seamless cubemaps), which can be sampled in
  59. custom shaders.
  60. - **CubemapArray:** Import the texture as a collection of 6-sided cubemaps,
  61. which can be sampled in custom shaders. This resource type can only be
  62. displayed when using the Forward+ or Forward Mobile rendering methods, not
  63. Compatibility.
  64. - **Font Data (Monospace Image Font):** Import the image as a bitmap font where
  65. all characters have the same width. See :ref:`doc_gui_using_fonts`.
  66. - **Image:** Import the image as-is. This resource type cannot be displayed
  67. directly onto 2D or 3D nodes, but the pixel values can be queried from a
  68. script using :ref:`get_pixel<class_Image_method_get_pixel>`.
  69. - **Texture2D:** Import the image as a 2-dimensional texture, suited for display
  70. on 2D and 3D surfaces. This is the default import mode.
  71. - **Texture2DArray:** Import the image as a collection of 2-dimensional textures.
  72. Texture2DArray is similar to a 3-dimensional texture, but without
  73. interpolation between layers. Built-in 2D and 3D shaders cannot display
  74. texture arrays, so you must create a custom shader in :ref:`2D <doc_canvas_item_shader>`
  75. or :ref:`3D <doc_spatial_shader>` to display a texture from a texture array.
  76. - **Texture3D:** Import the image as a 3-dimensional texture. This is *not* a 2D
  77. texture applied onto a 3D surface. Texture3D is similar to a texture array, but
  78. with interpolation between layers. Texture3D is typically used for
  79. :ref:`class_FogMaterial` density maps in :ref:`volumetric fog
  80. <doc_volumetric_fog>`, :ref:`class_Environment` 3D LUT color correction and
  81. custom shaders.
  82. - **TextureAtlas:** Import the image as an *atlas* of different textures. Can be
  83. used to reduce memory usage for animated 2D sprites. Only supported in 2D due
  84. to missing support in built-in 3D shaders.
  85. .. note::
  86. For technical reasons, the editor must be restarted after changing an import
  87. type in the Import dock.
  88. Detect 3D
  89. ^^^^^^^^^
  90. The default import options (no mipmaps and **Lossless** compression) are suited
  91. for 2D, but are not ideal for most 3D projects. **Detect 3D** makes Godot aware
  92. of when a texture is used in a 3D scene (such as a texture in a
  93. :ref:`class_BaseMaterial3D`). If this happens, several import options are
  94. changed so the texture flags are friendlier to 3D. Mipmaps are enabled and the
  95. compression mode is changed to **VRAM Compressed** unless
  96. :ref:`doc_importing_images_detect_3d_compress_to` is changed. The texture is
  97. also reimported automatically.
  98. A message is printed to the Output panel when a texture is detected to be used in 3D.
  99. If you run into quality issues when a texture is detected to be used in 3D (e.g.
  100. for pixel art textures), change the
  101. :ref:`doc_importing_images_detect_3d_compress_to` option before using the
  102. texture in 3D, or change :ref:`doc_importing_images_compress_mode` to
  103. **Lossless** after using the texture in 3D. This is preferable to disabling
  104. **Detect 3D**, as mipmap generation remains enabled to prevent textures from
  105. looking grainy at a distance.
  106. Import options
  107. --------------
  108. .. seealso::
  109. In Godot 4.0, changing the texture filter and repeat mode is no longer done
  110. in the import options.
  111. Instead, texture filter and repeat modes are changed in the CanvasItem
  112. properties in 2D (with a project setting acting as a default), and in a
  113. :ref:`per-material configuration in 3D <doc_standard_material_3d_sampling>`.
  114. In custom shaders, filter and repeat mode is changed on the ``sampler2D``
  115. uniform using hints described in the :ref:`doc_shading_language`
  116. documentation.
  117. .. _doc_importing_images_compress_mode:
  118. Compress > Mode
  119. ^^^^^^^^^^^^^^^
  120. Images are one of the largest assets in a game. To handle them efficiently, they
  121. need to be compressed. Godot offers several compression methods, depending on
  122. the use case.
  123. - **Lossless:** This is the default and most common compression mode for 2D assets.
  124. It shows assets without any kind of artifacting, and disk compression is
  125. decent. It will use considerably more amount of video memory than
  126. VRAM Compression, though. This is also the recommended setting for pixel art.
  127. - **Lossy:** This is a good choice for large 2D assets. It has some artifacts,
  128. but less than VRAM compression and the file size is several times lower
  129. compared to Lossless or VRAM Uncompressed. Video memory usage isn't decreased
  130. by this mode; it's the same as with Lossless or VRAM Uncompressed.
  131. - **VRAM Compressed:** This is the default and most common compression mode for
  132. 3D assets. Size on disk is reduced and video memory usage is also decreased
  133. considerably (usually by a factor between 4 and 6). This mode should be
  134. avoided for 2D as it exhibits noticeable artifacts, especially for
  135. lower-resolution textures.
  136. - **VRAM Uncompressed:** Only useful for formats that can't be compressed, such
  137. as raw floating-point images.
  138. - **Basis Universal:** This alternative VRAM compression mode encodes the
  139. texture to a format that can be transcoded to most GPU-compressed formats at
  140. load-time. This provides very small files that make use of VRAM compression,
  141. at the cost of lower quality compared to VRAM Compressed and slow compression
  142. times. VRAM usage is usually the same as VRAM Compressed. Basis Universal does
  143. not support floating-point image formats (the engine will internally fall back
  144. to VRAM Compressed instead).
  145. .. note::
  146. Even in 3D, "pixel art" textures should have VRAM compression disabled as it
  147. will negatively affect their appearance, without improving performance
  148. significantly due to their low resolution.
  149. In this table, each of the 5 options are described together with their
  150. advantages and disadvantages (|good| = best, |bad| = worst):
  151. +------------------+-------------------------------+----------------------+------------------------------------------------------+------------------------+--------------------------------------+
  152. | Compress mode | Lossless | Lossy | VRAM Compressed | VRAM Uncompressed | Basis Universal |
  153. +==================+===============================+======================+======================================================+========================+======================================+
  154. | **Description** | Stored as Lossless WebP / PNG | Stored as Lossy WebP | Stored as S3TC, BPTC or ETC2 depending on platform | Stored as raw pixels | Transcoded to VRAM Compressed format |
  155. +------------------+-------------------------------+----------------------+------------------------------------------------------+------------------------+--------------------------------------+
  156. | **Size on disk** | |regular| Small | |good| Very small | |regular| Small | |bad| Large | |good| Very small |
  157. +------------------+-------------------------------+----------------------+------------------------------------------------------+------------------------+--------------------------------------+
  158. | **Memory usage** | |bad| Large | |bad| Large | |good| Small | |bad| Large | |good| Small |
  159. +------------------+-------------------------------+----------------------+------------------------------------------------------+------------------------+--------------------------------------+
  160. | **Performance** | |regular| Normal | |regular| Normal | |good| Fast | |regular| Normal | |good| Fast |
  161. +------------------+-------------------------------+----------------------+------------------------------------------------------+------------------------+--------------------------------------+
  162. | **Quality loss** | |good| None | |regular| Slight | |bad| Moderate | |good| None | |bad| Moderate |
  163. +------------------+-------------------------------+----------------------+------------------------------------------------------+------------------------+--------------------------------------+
  164. | **Load time** | |bad| Slow | |bad| Slow | |good| Fast | |regular| Normal | |regular| Normal |
  165. +------------------+-------------------------------+----------------------+------------------------------------------------------+------------------------+--------------------------------------+
  166. .. |bad| image:: img/bad.png
  167. .. |good| image:: img/good.png
  168. .. |regular| image:: img/regular.png
  169. Estimated memory usage for a single RGBA8 texture with mipmaps enabled:
  170. +---------------+---------------------+---------------------+---------------------+---------------------+---------------------+
  171. | Texture size | Lossless | Lossy | VRAM Compressed | VRAM Uncompressed | Basis Universal |
  172. +===============+=====================+=====================+=====================+=====================+=====================+
  173. | **128×128** | |good| 85 KiB | |good| 85 KiB | |good| 21 KiB | |good| 85 KiB | |good| 21 KiB |
  174. +---------------+---------------------+---------------------+---------------------+---------------------+---------------------+
  175. | **256×256** | |good| 341 KiB | |good| 341 KiB | |good| 85 KiB | |good| 341 KiB | |good| 85 KiB |
  176. +---------------+---------------------+---------------------+---------------------+---------------------+---------------------+
  177. | **512×512** | |good| 1.33 MiB | |good| 1.33 MiB | |good| 341 KiB | |good| 1.33 MiB | |good| 341 KiB |
  178. +---------------+---------------------+---------------------+---------------------+---------------------+---------------------+
  179. | **1024×1024** | |regular| 5.33 MiB | |regular| 5.33 MiB | |good| 1.33 MiB | |regular| 5.33 MiB | |good| 1.33 MiB |
  180. +---------------+---------------------+---------------------+---------------------+---------------------+---------------------+
  181. | **2048×2048** | |bad| 21.33 MiB | |bad| 21.33 MiB | |regular| 5.33 MiB | |bad| 21.33 MiB | |regular| 5.33 MiB |
  182. +---------------+---------------------+---------------------+---------------------+---------------------+---------------------+
  183. | **4096×4096** | |bad| 85.33 MiB | |bad| 85.33 MiB | |bad| 21.33 MiB | |bad| 85.33 MiB | |bad| 21.33 MiB |
  184. +---------------+---------------------+---------------------+---------------------+---------------------+---------------------+
  185. .. note::
  186. In the above table, memory usage will be reduced by 25% for images that do
  187. not have an alpha channel (RGB8). Memory usage will be further decreased by
  188. 25% for images that have mipmaps disabled.
  189. Notice how at larger resolutions, the impact of VRAM compression is much
  190. greater. With a 4:1 compression ratio (6:1 for opaque textures with S3TC), VRAM
  191. compression effectively allows a texture to be twice as large on each axis,
  192. while using the same amount of memory on the GPU.
  193. VRAM compression also reduces the memory bandwidth required to sample the
  194. texture, which can speed up rendering in memory bandwidth-constrained scenarios
  195. (which are frequent on integrated graphics and mobile). These factors combined
  196. make VRAM compression a must-have for 3D games with high-resolution textures.
  197. You can preview how much memory a texture takes by double-clicking it in the
  198. FileSystem dock, then looking at the Inspector:
  199. .. figure:: img/importing_images_inspector_preview.webp
  200. :align: center
  201. :alt: Previewing a texture in the Inspector
  202. Previewing a texture in the Inspector. Credit: `Red Brick 03 - Poly Haven <https://polyhaven.com/a/red_brick_03>`__
  203. Compress > High Quality
  204. ^^^^^^^^^^^^^^^^^^^^^^^
  205. .. note::
  206. High-quality VRAM texture compression is only supported in the Forward+ and
  207. Forward Mobile rendering methods.
  208. When using the Compatibility rendering method, this option is always
  209. considered disabled.
  210. If enabled, uses BPTC compression on desktop platforms and :abbr:`ASTC (Adaptive
  211. Scalable Texture Compression)` compression on mobile platforms. When using BPTC,
  212. BC7 is used for SDR textures and BC6H is used for HDR textures.
  213. If disabled (default), uses the faster but lower-quality S3TC compression on
  214. desktop platforms and ETC2 on mobile/web platforms. When using S3TC, DXT1 (BC1)
  215. is used for opaque textures and DXT5 (BC3) is used for transparent or normal map
  216. (:abbr:`RGTC (Red-Green Texture Compression)`) textures.
  217. BPTC and ASTC support VRAM compression for HDR textures, but S3TC and ETC2 do
  218. not (see **HDR Compression** below).
  219. Compress > HDR Compression
  220. ^^^^^^^^^^^^^^^^^^^^^^^^^^
  221. .. note::
  222. This option only has an effect on textures that are imported as HDR formats in Godot
  223. (``.hdr`` and ``.exr`` files).
  224. If set to **Disabled**, never uses VRAM compression for HDR textures, regardless
  225. of whether they're opaque or transparent. Instead, the texture is converted to
  226. RGBE9995 (9-bits per channel + 5-bit exponent = 32 bits per pixel) to reduce
  227. memory usage compared to a half-float or single-precision float image format.
  228. If set to **Opaque Only** (default), only uses VRAM compression for opaque HDR
  229. textures. This is due to a limitation of HDR formats, as there is no
  230. VRAM-compressed HDR format that supports transparency at the same time.
  231. If set to **Always**, will force VRAM compression even for HDR textures with an
  232. alpha channel. To perform this, the alpha channel is discarded on import.
  233. Compress > Normal Map
  234. ^^^^^^^^^^^^^^^^^^^^^
  235. When using a texture as normal map, only the red and green channels are
  236. required. Given regular texture compression algorithms produce artifacts that
  237. don't look that nice in normal maps, the :abbr:`RGTC (Red-Green Texture Compression)`
  238. compression format is the best fit for this data. Forcing this option to **Enable**
  239. will make Godot import the image as :abbr:`RGTC (Red-Green Texture Compression)` compressed.
  240. By default, it's set to **Detect**. This means that if the texture is ever detected to
  241. be used as a normal map, it will be changed to **Enable** and reimported automatically.
  242. Note that :abbr:`RGTC (Red-Green Texture Compression)` compression affects the
  243. resulting normal map image. You will have to adjust custom shaders that use the
  244. normal map's blue channel to take this into account. Built-in material shaders
  245. already ignore the blue channel in a normal map (regardless of the actual normal
  246. map's contents).
  247. In the example below, the normal map with :abbr:`RGTC (Red-Green Texture Compression)`
  248. compression is able to preserve its detail much better, while
  249. using the same amount of memory as a standard RGBA VRAM-compressed texture:
  250. .. figure:: img/importing_images_normal_map_rgtc.webp
  251. :align: center
  252. :alt: Normal map with standard VRAM compression (left) and with RGTC VRAM compression (right)
  253. Normal map with standard VRAM compression (left) and with RGTC VRAM compression (right)
  254. .. note::
  255. Godot requires the normal map to use the X+, Y+ and Z+ coordinates, which is
  256. known as an OpenGL-style normal map. If you've imported a material made to be
  257. used with another engine, it may be DirectX-style. In this case, the normal map
  258. needs to be converted by enabling the **Normal Map Invert Y** import option.
  259. More information about normal maps (including a coordinate order table for
  260. popular engines) can be found
  261. `here <http://wiki.polycount.com/wiki/Normal_Map_Technical_Details>`__.
  262. Compress > Channel Pack
  263. ^^^^^^^^^^^^^^^^^^^^^^^
  264. If set to **sRGB Friendly** (default), prevents the RG color format from being
  265. used as it does not support sRGB color.
  266. If set to **Optimized**, allows the RG color format to be used if the texture
  267. does not use the blue channel.
  268. A third option **Normal Map (RG Channels)** is *only* available in layered
  269. textures (:ref:`class_Cubemap`, :ref:`class_CubemapArray`, :ref:`class_Texture2DArray`
  270. and :ref:`class_Texture3D`). This forces all layers from the texture to be imported
  271. with the RG color format to reduce memory usage, with only the red and green
  272. channels preserved. This only has an effect on textures with the **VRAM Compressed**
  273. or **Basis Universal** compression modes.
  274. Mipmaps > Generate
  275. ^^^^^^^^^^^^^^^^^^
  276. If enabled, smaller versions of the texture are generated on import. For
  277. example, a 64×64 texture will generate 6 mipmaps (32×32, 16×16, 8×8, 4×4, 2×2,
  278. 1×1). This has several benefits:
  279. - Textures will not become grainy in the distance (in 3D), or if scaled down due
  280. to camera zoom or CanvasItem scale (in 2D).
  281. - Performance will improve if the texture is displayed in the distance, since
  282. sampling smaller versions of the original texture is faster and requires less
  283. memory bandwidth.
  284. The downside of mipmaps is that they increase memory usage by roughly 33%.
  285. It's recommended to enable mipmaps in 3D. However, in 2D, this should only be
  286. enabled if your project visibly benefits from having mipmaps enabled. If the
  287. camera never zooms out significantly, there won't be a benefit to enabling
  288. mipmaps but memory usage will increase.
  289. Mipmaps > Limit
  290. ^^^^^^^^^^^^^^^
  291. .. warning::
  292. **Mipmaps > Limit** is currently not implemented and has no effect when changed.
  293. If set to a value greater than ``-1``, limits the maximum number of mipmaps that
  294. can be generated. This can be decreased if you don't want textures to become too
  295. low-resolution at extreme distances, at the cost of some graininess.
  296. Roughness > Mode
  297. ^^^^^^^^^^^^^^^^
  298. The color channel to consider as a roughness map in this texture. Only effective if
  299. **Roughness > Src Normal** is not empty.
  300. Rougness > Src Normal
  301. ^^^^^^^^^^^^^^^^^^^^^
  302. The path to the texture to consider as a normal map for roughness filtering on
  303. import. Specifying this can help decrease specular aliasing slightly in 3D.
  304. Roughness filtering on import is only used in 3D rendering, not 2D.
  305. Process > Fix Alpha Border
  306. ^^^^^^^^^^^^^^^^^^^^^^^^^^
  307. This puts pixels of the same surrounding color in transition from transparent to
  308. opaque areas. For textures displayed with bilinear filtering, this helps
  309. mitigate the outline effect when exporting images from an image editor.
  310. .. image:: img/fixedborder.png
  311. It's recommended to leave this enabled (as it is by default), unless this causes
  312. issues for a particular image.
  313. Process > Premult Alpha
  314. ^^^^^^^^^^^^^^^^^^^^^^^
  315. An alternative to fixing darkened borders with **Fix Alpha Border** is to use
  316. premultiplied alpha. By enabling this option, the texture will be converted to
  317. this format. A premultiplied alpha texture requires specific materials to be
  318. displayed correctly:
  319. - In 2D, a :ref:`class_CanvasItemMaterial` will need to be created and
  320. configured to use the **Premul Alpha** blend mode on CanvasItems that use this
  321. texture.
  322. - In 3D, there is no support for premultiplied alpha blend mode yet, so this
  323. option is only suited for 2D.
  324. Process > Normal Map Invert Y
  325. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  326. Godot requires the normal map to use the X+, Y+ and Z+ coordinates, which is
  327. known as an OpenGL-style normal map. If you've imported a material made to be
  328. used with another engine, it may be DirectX-style. In this case, the normal map
  329. needs to be converted by enabling the **Normal Map Invert Y** import option.
  330. More information about normal maps (including a coordinate order table for
  331. popular engines) can be found
  332. `here <http://wiki.polycount.com/wiki/Normal_Map_Technical_Details>`__.
  333. Process > HDR as sRGB
  334. ^^^^^^^^^^^^^^^^^^^^^
  335. Some HDR images you can find online may be broken and contain sRGB color data
  336. (instead of linear color data). It is advised not to use those files. If you
  337. absolutely have to, enabling this option on will make them look correct.
  338. .. warning::
  339. Enabling **HDR as sRGB** on well-formatted HDR images will cause the
  340. resulting image to look too dark, so leave this disabled if unsure.
  341. Process > HDR Clamp Exposure
  342. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  343. Some HDR panorama images you can find online may contain extremely bright
  344. pixels, due to being taken from real life sources without any clipping.
  345. While these HDR panorama images are accurate to real life, this can cause the
  346. radiance map generated by Godot to contain sparkles when used as a background
  347. sky. This can be seen in material reflections (even on rough materials in
  348. extreme cases). Enabling **HDR Clamp Exposure** can resolve this using a smart
  349. clamping formula that does not introduce *visible* clipping – glow will keep
  350. working when looking at the background sky.
  351. Process > Size Limit
  352. ^^^^^^^^^^^^^^^^^^^^
  353. If set to a value greater than ``0``, the size of the texture is limited on
  354. import to a value smaller than or equal to the value specified here. For
  355. non-square textures, the size limit affects the longer dimension, with the
  356. shorter dimension scaled to preserve aspect ratio. Resizing is performed using
  357. cubic interpolation.
  358. This can be used to reduce memory usage without affecting the source images, or
  359. avoid issues with textures not displaying on mobile/web platforms (as these
  360. usually can't display textures larger than 4096×4096).
  361. .. _doc_importing_images_detect_3d_compress_to:
  362. Detect 3D > Compress To
  363. ^^^^^^^^^^^^^^^^^^^^^^^
  364. This changes the :ref:`doc_importing_images_compress_mode` option that is used
  365. when a texture is detected as being used in 3D.
  366. Changing this import option only has an effect if a texture is detected as being
  367. used in 3D. Changing this to **Disabled** then reimporting will not change the
  368. existing compress mode on a texture (if it's detected to be used in 3D), but
  369. choosing **VRAM Compressed** or **Basis Universal** will.
  370. Best practices
  371. --------------
  372. Supporting high-resolution texture sizes in 2D without artifacts
  373. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  374. To support :ref:`multiple resolutions <doc_multiple_resolutions>` with crisp
  375. visuals at high resolutions, you will need to use high-resolution source images
  376. (suited for the highest resolution you wish to support without blurriness, which
  377. is typically 4K in modern desktop games).
  378. There are 2 ways to proceed:
  379. - Use a high base resolution in the project settings (such as 4K), then use the
  380. textures at original scale. This is an easier approach.
  381. - Use a low base resolution in the project settings (such as 1080p), then
  382. downscale textures when using them. This is often more difficult and can make
  383. various calculations in script tedious, so the approach described above is
  384. recommended instead.
  385. After doing this, you may notice that textures become grainy at lower viewport
  386. resolutions. To resolve this, enable **Mipmaps** on textures used in 2D in the
  387. Import dock. This will increase memory usage.
  388. Enabling mipmaps can also make textures appear blurrier, but you can choose
  389. to make textures sharper (at the cost of some graininess) by setting
  390. **Rendering > Textures > Default Filters > Texture Mipmap Bias** to a
  391. negative value.
  392. Use appropriate texture sizes in 3D
  393. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  394. While there's no "one size fits all" recommendation, here are some general
  395. recommendations for choosing texture sizes in 3D:
  396. - The size of a texture should be adjusted to have a consistent texel density
  397. compared to surrounding objects. While this cannot be ensured perfectly when
  398. sticking to power-of-two texture sizes, it's usually possible to keep texture
  399. detail fairly consistent throughout a 3D scene.
  400. - The smaller the object appears on screen, the smaller its texture should be.
  401. For example, a tree that only appears in the background doesn't need a texture
  402. resolution as high as other objects the player may be able to walk close to.
  403. - Using power-of-two texture sizes is recommended, but is not required. Textures
  404. don't have to be square – sizes such as 1024×512 are acceptable.
  405. - There are diminishing returns to using large texture sizes, despite the
  406. increased memory usage and loading times. Most modern 3D games not using a
  407. pixel art style stick to 2048×2048 textures on average, with 1024×1024 and
  408. 512×512 for textures spanning smaller surfaces.
  409. - When working with physically-based materials in 3D, you can reduce memory
  410. usage and file size without affecting quality too much by using a lower
  411. resolution for certain texture maps. This works especially well for textures
  412. that only feature low-frequency detail (such as a normal map for a snow
  413. texture).
  414. If you have control over how the 3D models are created, these tips are also
  415. worth exploring:
  416. - When working with 3D models that are mostly symmetrical, you may be able to
  417. use mirrored UVs to double the effective texel density. This may look
  418. unnatural when used on human faces though.
  419. - When working with 3D models using a low-poly style and plain colors, you can
  420. rely on vertex colors instead of textures to represent colors on the model's
  421. surfaces.