Skip to content

Commit

Permalink
Update resource importing documentation for Godot 4.0
Browse files Browse the repository at this point in the history
- Add best practices for importing images and audio, such as
  texture size recommendations.
  • Loading branch information
Calinou committed Feb 16, 2023
1 parent 80f5259 commit 7313c4e
Show file tree
Hide file tree
Showing 21 changed files with 774 additions and 193 deletions.
5 changes: 5 additions & 0 deletions tutorials/3d/3d_rendering_limitations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ your texture to display correctly on all platforms, you should avoid using
textures larger than 4096×4096 and use a power of two size if the texture needs
to repeat.

To limit the size of a specific texture that may be too large to render, you can
set the **Process > Size Limit** import option to a value greater than ``0``.
This will reduce the texture's dimensions on import (preserving aspect ratio)
without affecting the source file.

.. _doc_3d_rendering_limitations_color_banding:

Color banding
Expand Down
2 changes: 2 additions & 0 deletions tutorials/3d/standard_material_3d.rst
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,8 @@ World Triplanar
When using triplanar mapping, it is computed in object local space. This
option makes it use world space instead.

.. _doc_standard_material_3d_sampling:

Sampling
--------

Expand Down
2 changes: 2 additions & 0 deletions tutorials/3d/volumetric_fog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ the following properties in FogMaterial:
of the FogVolume. This can be used to vary fog density within the FogVolume
with any kind of static pattern. For animated effects, consider using a custom
:ref:`fog shader <doc_fog_shader>`.
You can import any image as a 3D texture by
:ref:`changing its import type in the Import dock <doc_importing_images_changing_import_type>`.

Custom FogVolume shaders
------------------------
Expand Down
Binary file removed tutorials/assets_pipeline/img/asset_workflow1.png
Binary file not shown.
Binary file removed tutorials/assets_pipeline/img/asset_workflow2.png
Binary file not shown.
Binary file removed tutorials/assets_pipeline/img/asset_workflow3.png
Binary file not shown.
Binary file removed tutorials/assets_pipeline/img/asset_workflow4.png
Binary file not shown.
Binary file removed tutorials/assets_pipeline/img/asset_workflow5.png
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
103 changes: 66 additions & 37 deletions tutorials/assets_pipeline/import_process.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,23 @@
Import process
==============

Importing assets in Godot 3.0+
------------------------------
Importing assets in Godot
-------------------------

Previously, importing assets in Godot 2.x required manual maintenance
of a separate directory with source assets. Without doing this, it was
impossible to specify how to convert and change import flags for
textures, audio files, scenes, etc.

In Godot 3.0+, we use a more modern approach to importing: Simply drop
In Godot 3.0we use a more modern approach to importing: Simply drop
your assets (image files, scenes, audio files, fonts, etc) directly in the
project folder (copy them manually with your OS file explorer).
project folder (copy them manually with your operating system's file manager).
Godot will automatically import these files internally
and keep the imported resources hidden in a ``res://.import`` folder.

This means that when trying to access imported assets through code you
This means that when trying to access imported assets through code, you
need to use the :ref:`Resource Loader<class_ResourceLoader>` as it will
automatically take into account where the internal files are saved. If you
try and access an imported asset using the :ref:`FileAccess <class_FileAccess>` class
it will work in the editor, but break in the exported project.
try and access an imported asset using the :ref:`FileAccess <class_FileAccess>` class,
it will work in the editor, but **it will break in the exported project**.

However, the :ref:`Resource Loader<class_ResourceLoader>` cannot access
non imported files, only the :ref:`FileAccess <class_FileAccess>` class can.
non-imported files. Only the :ref:`FileAccess <class_FileAccess>` class can.

Changing import parameters
--------------------------
Expand All @@ -33,7 +28,7 @@ To change the import parameters of an asset in Godot (again, keep in mind
import parameters are only present in non-native Godot resource types)
select the relevant resource in the filesystem dock:

.. image:: img/asset_workflow1.png
.. image:: img/import_process_example.webp

Then, after adjusting the parameters, press "Reimport". These parameters
will only be used for this asset and on future reimports.
Expand All @@ -42,6 +37,11 @@ Changing the import parameters of several assets at the same time is also
possible. Simply select all of them together in the resources dock and the
exposed parameters will apply to all of them when reimporting.

Default import parameters for
Custom fonts' properties are governed by their respective import options
instead. You can use the **Import Defaults** section of the Project Settings
dialog to override default import options for custom fonts.

Reimporting multiple assets
---------------------------

Expand All @@ -66,48 +66,77 @@ automatic reimport of it, applying the preset configured for that specific
asset.

Files generated
-----------------
---------------

Importing will add an extra ``<asset>.import`` file next to the source file,
containing the import configuration.

Importing will add an extra ``<asset>.import`` file, containing the import
configuration. Make sure to commit these to your version control system!
**Make sure to commit these files to your version control system**, as these
files contain important metadata.

.. image:: img/asset_workflow4.png
::

Additionally, extra assets will be preset in the hidden ``res://.import`` folder:
$ ls
example.png
example.png.import
project.godot

.. image:: img/asset_workflow5.png
Additionally, extra assets will be preset in the hidden
``res://.godot/imported/`` folder:

::

$ ls .godot/imported
example.png-218a8f2b3041327d8a5756f3a245f83b.ctex
example.png-218a8f2b3041327d8a5756f3a245f83b.md5

If any of the files present in this folder is erased (or the whole folder), the
asset or assets will be reimported automatically. As such, committing this folder
to the version control system is optional. It can shorten
reimporting time when checking out on another computer, but it takes considerably
more space and transfer time. Pick your poison!
asset or assets will be reimported automatically. As such, committing the
``.godot/`` folder to the version control system is not recommended. While
committing this folder can shorten reimporting time when checking out on another
computer, it requires considerably more space and bandwidth.

The default version control metadata that can be generated on project creation
will automatically ignore the ``.godot/`` folder.

Changing import resource type
-----------------------------

Some source assets can be imported as different types of resources.
For this, select the relevant type of resource desired and
press "Reimport":
Some source assets can be imported as different types of resources. For this,
select the relevant type of resource desired then click **Reimport**:

.. image:: img/asset_workflow2.png
.. image:: img/import_process_changing_import_type.webp

.. note::

For technical reasons, the editor must be restarted after changing an import
type in the Import dock.

Changing default import parameters
-----------------------------------
----------------------------------

Different types of games might require different defaults.
Changing the defaults per project can be achieved by using the
"Preset.." Menu. Besides some resource types offering presets,
**Preset...** Menu. Besides some resource types offering presets,
the default setting can be saved and cleared too:

.. image:: img/asset_workflow3.png
.. image:: img/import_process_change_preset.webp

Simplicity is key!
------------------
The default import parameters for a given resource type can be changed
project-wide using the **Import Defaults** tab of the Project Settings dialog:

.. image:: img/import_process_import_defaults.webp

Further reading
---------------

This workflow takes a little time to get used to, but it enforces a more correct
way to deal with resources.

This workflow is aimed to be simple and take very little time to get used to. It also enforces a more
correct way to deal with resources.
There are many types of assets available for import. Continue reading to
understand how to work with all of them:

There are many types of assets available for import, so please continue reading to understand how to work
with all of them!
- :ref:`doc_importing_images`
- :ref:`doc_importing_audio_samples`
- :ref:`doc_importing_3d_scenes`
- :ref:`doc_importing_translations`
Loading

0 comments on commit 7313c4e

Please sign in to comment.