Files
godot-docs-l10n/classes/zh_Hant/class_lightmapgi.rst

757 lines
40 KiB
ReStructuredText
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

:github_url: hide
.. _class_LightmapGI:
LightmapGI
==========
**繼承:** :ref:`VisualInstance3D<class_VisualInstance3D>` **<** :ref:`Node3D<class_Node3D>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
計算並儲存烘焙光照貼圖,以實作快速全域照明。
.. rst-class:: classref-introduction-group
說明
----
The **LightmapGI** node is used to compute and store baked lightmaps. Lightmaps are used to provide high-quality indirect lighting with very little light leaking. **LightmapGI** can also provide rough reflections using spherical harmonics if :ref:`directional<class_LightmapGI_property_directional>` is enabled. Dynamic objects can receive indirect lighting thanks to *light probes*, which can be automatically placed by setting :ref:`generate_probes_subdiv<class_LightmapGI_property_generate_probes_subdiv>` to a value other than :ref:`GENERATE_PROBES_DISABLED<class_LightmapGI_constant_GENERATE_PROBES_DISABLED>`. Additional lightmap probes can also be added by creating :ref:`LightmapProbe<class_LightmapProbe>` nodes. The downside is that lightmaps are fully static and cannot be baked in an exported project. Baking a **LightmapGI** node is also slower compared to :ref:`VoxelGI<class_VoxelGI>`.
\ **Procedural generation:** Lightmap baking functionality is only available in the editor. This means **LightmapGI** is not suited to procedurally generated or user-built levels. For procedurally generated or user-built levels, use :ref:`VoxelGI<class_VoxelGI>` or SDFGI instead (see :ref:`Environment.sdfgi_enabled<class_Environment_property_sdfgi_enabled>`).
\ **Performance:** **LightmapGI** provides the best possible run-time performance for global illumination. It is suitable for low-end hardware including integrated graphics and mobile devices.
\ **Note:** Due to how lightmaps work, most properties only have a visible effect once lightmaps are baked again.
\ **Note:** Lightmap baking on :ref:`CSGShape3D<class_CSGShape3D>`\ s and :ref:`PrimitiveMesh<class_PrimitiveMesh>`\ es is not supported, as these cannot store UV2 data required for baking.
\ **Note:** If no custom lightmappers are installed, **LightmapGI** can only be baked from devices that support the Forward+ or Mobile renderers.
\ **Note:** The **LightmapGI** node only bakes light data for child nodes of its parent. Nodes further up the hierarchy of the scene will not be baked.
.. rst-class:: classref-introduction-group
教學
----
- :doc:`使用光照貼圖全域光照 <../tutorials/3d/global_illumination/using_lightmap_gi>`
.. rst-class:: classref-reftable-group
屬性
----
.. table::
:widths: auto
+-----------------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+
| :ref:`float<class_float>` | :ref:`bias<class_LightmapGI_property_bias>` | ``0.0005`` |
+-----------------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+
| :ref:`float<class_float>` | :ref:`bounce_indirect_energy<class_LightmapGI_property_bounce_indirect_energy>` | ``1.0`` |
+-----------------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+
| :ref:`int<class_int>` | :ref:`bounces<class_LightmapGI_property_bounces>` | ``3`` |
+-----------------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+
| :ref:`CameraAttributes<class_CameraAttributes>` | :ref:`camera_attributes<class_LightmapGI_property_camera_attributes>` | |
+-----------------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+
| :ref:`int<class_int>` | :ref:`denoiser_range<class_LightmapGI_property_denoiser_range>` | ``10`` |
+-----------------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+
| :ref:`float<class_float>` | :ref:`denoiser_strength<class_LightmapGI_property_denoiser_strength>` | ``0.1`` |
+-----------------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+
| :ref:`bool<class_bool>` | :ref:`directional<class_LightmapGI_property_directional>` | ``false`` |
+-----------------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+
| :ref:`Color<class_Color>` | :ref:`environment_custom_color<class_LightmapGI_property_environment_custom_color>` | ``Color(1, 1, 1, 1)`` |
+-----------------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+
| :ref:`float<class_float>` | :ref:`environment_custom_energy<class_LightmapGI_property_environment_custom_energy>` | ``1.0`` |
+-----------------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+
| :ref:`Sky<class_Sky>` | :ref:`environment_custom_sky<class_LightmapGI_property_environment_custom_sky>` | |
+-----------------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+
| :ref:`EnvironmentMode<enum_LightmapGI_EnvironmentMode>` | :ref:`environment_mode<class_LightmapGI_property_environment_mode>` | ``1`` |
+-----------------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+
| :ref:`GenerateProbes<enum_LightmapGI_GenerateProbes>` | :ref:`generate_probes_subdiv<class_LightmapGI_property_generate_probes_subdiv>` | ``2`` |
+-----------------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+
| :ref:`bool<class_bool>` | :ref:`interior<class_LightmapGI_property_interior>` | ``false`` |
+-----------------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+
| :ref:`LightmapGIData<class_LightmapGIData>` | :ref:`light_data<class_LightmapGI_property_light_data>` | |
+-----------------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+
| :ref:`int<class_int>` | :ref:`max_texture_size<class_LightmapGI_property_max_texture_size>` | ``16384`` |
+-----------------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+
| :ref:`BakeQuality<enum_LightmapGI_BakeQuality>` | :ref:`quality<class_LightmapGI_property_quality>` | ``1`` |
+-----------------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+
| :ref:`ShadowmaskMode<enum_LightmapGIData_ShadowmaskMode>` | :ref:`shadowmask_mode<class_LightmapGI_property_shadowmask_mode>` | ``0`` |
+-----------------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+
| :ref:`bool<class_bool>` | :ref:`supersampling<class_LightmapGI_property_supersampling>` | ``false`` |
+-----------------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+
| :ref:`float<class_float>` | :ref:`supersampling_factor<class_LightmapGI_property_supersampling_factor>` | ``2.0`` |
+-----------------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+
| :ref:`float<class_float>` | :ref:`texel_scale<class_LightmapGI_property_texel_scale>` | ``1.0`` |
+-----------------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+
| :ref:`bool<class_bool>` | :ref:`use_denoiser<class_LightmapGI_property_use_denoiser>` | ``true`` |
+-----------------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+
| :ref:`bool<class_bool>` | :ref:`use_texture_for_bounces<class_LightmapGI_property_use_texture_for_bounces>` | ``true`` |
+-----------------------------------------------------------+---------------------------------------------------------------------------------------+-----------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
列舉
----
.. _enum_LightmapGI_BakeQuality:
.. rst-class:: classref-enumeration
enum **BakeQuality**: :ref:`🔗<enum_LightmapGI_BakeQuality>`
.. _class_LightmapGI_constant_BAKE_QUALITY_LOW:
.. rst-class:: classref-enumeration-constant
:ref:`BakeQuality<enum_LightmapGI_BakeQuality>` **BAKE_QUALITY_LOW** = ``0``
較低的烘焙品質(最快的烘焙時間)。可以通過更改 :ref:`ProjectSettings.rendering/lightmapping/bake_quality/low_quality_ray_count<class_ProjectSettings_property_rendering/lightmapping/bake_quality/low_quality_ray_count>`:ref:`ProjectSettings.rendering/lightmapping/bake_quality/low_quality_probe_ray_count<class_ProjectSettings_property_rendering/lightmapping/bake_quality/low_quality_probe_ray_count>` 來調整此預設的品質。
.. _class_LightmapGI_constant_BAKE_QUALITY_MEDIUM:
.. rst-class:: classref-enumeration-constant
:ref:`BakeQuality<enum_LightmapGI_BakeQuality>` **BAKE_QUALITY_MEDIUM** = ``1``
中等的烘焙品質(較快的烘焙時間)。可以通過更改 :ref:`ProjectSettings.rendering/lightmapping/bake_quality/medium_quality_ray_count<class_ProjectSettings_property_rendering/lightmapping/bake_quality/medium_quality_ray_count>`:ref:`ProjectSettings.rendering/lightmapping/bake_quality/medium_quality_probe_ray_count<class_ProjectSettings_property_rendering/lightmapping/bake_quality/medium_quality_probe_ray_count>` 來調整此預設的品質。
.. _class_LightmapGI_constant_BAKE_QUALITY_HIGH:
.. rst-class:: classref-enumeration-constant
:ref:`BakeQuality<enum_LightmapGI_BakeQuality>` **BAKE_QUALITY_HIGH** = ``2``
較高的烘焙品質(較慢的烘焙時間)。可以通過更改 :ref:`ProjectSettings.rendering/lightmapping/bake_quality/high_quality_ray_count<class_ProjectSettings_property_rendering/lightmapping/bake_quality/high_quality_ray_count>`:ref:`ProjectSettings.rendering/lightmapping/bake_quality/high_quality_probe_ray_count<class_ProjectSettings_property_rendering/lightmapping/bake_quality/high_quality_probe_ray_count>` 來調整此預設的品質。
.. _class_LightmapGI_constant_BAKE_QUALITY_ULTRA:
.. rst-class:: classref-enumeration-constant
:ref:`BakeQuality<enum_LightmapGI_BakeQuality>` **BAKE_QUALITY_ULTRA** = ``3``
最高的烘焙品質(最慢的烘焙時間)。可以通過更改 :ref:`ProjectSettings.rendering/lightmapping/bake_quality/high_quality_ray_count<class_ProjectSettings_property_rendering/lightmapping/bake_quality/high_quality_ray_count>`:ref:`ProjectSettings.rendering/lightmapping/bake_quality/ultra_quality_probe_ray_count<class_ProjectSettings_property_rendering/lightmapping/bake_quality/ultra_quality_probe_ray_count>` 來調整此預設的品質。
.. rst-class:: classref-item-separator
----
.. _enum_LightmapGI_GenerateProbes:
.. rst-class:: classref-enumeration
enum **GenerateProbes**: :ref:`🔗<enum_LightmapGI_GenerateProbes>`
.. _class_LightmapGI_constant_GENERATE_PROBES_DISABLED:
.. rst-class:: classref-enumeration-constant
:ref:`GenerateProbes<enum_LightmapGI_GenerateProbes>` **GENERATE_PROBES_DISABLED** = ``0``
不要為光照動態物件生成光照貼圖探查。
.. _class_LightmapGI_constant_GENERATE_PROBES_SUBDIV_4:
.. rst-class:: classref-enumeration-constant
:ref:`GenerateProbes<enum_LightmapGI_GenerateProbes>` **GENERATE_PROBES_SUBDIV_4** = ``1``
最低級別的細分(烘焙時間最快,檔大小最小)。
.. _class_LightmapGI_constant_GENERATE_PROBES_SUBDIV_8:
.. rst-class:: classref-enumeration-constant
:ref:`GenerateProbes<enum_LightmapGI_GenerateProbes>` **GENERATE_PROBES_SUBDIV_8** = ``2``
較低級別的細分(烘焙時間較快,檔大小較小)。
.. _class_LightmapGI_constant_GENERATE_PROBES_SUBDIV_16:
.. rst-class:: classref-enumeration-constant
:ref:`GenerateProbes<enum_LightmapGI_GenerateProbes>` **GENERATE_PROBES_SUBDIV_16** = ``3``
較高級別的細分(烘焙時間較慢,檔大小較大)。
.. _class_LightmapGI_constant_GENERATE_PROBES_SUBDIV_32:
.. rst-class:: classref-enumeration-constant
:ref:`GenerateProbes<enum_LightmapGI_GenerateProbes>` **GENERATE_PROBES_SUBDIV_32** = ``4``
最高級別的細分(烘焙時間最慢,檔大小最大)。
.. rst-class:: classref-item-separator
----
.. _enum_LightmapGI_BakeError:
.. rst-class:: classref-enumeration
enum **BakeError**: :ref:`🔗<enum_LightmapGI_BakeError>`
.. _class_LightmapGI_constant_BAKE_ERROR_OK:
.. rst-class:: classref-enumeration-constant
:ref:`BakeError<enum_LightmapGI_BakeError>` **BAKE_ERROR_OK** = ``0``
光照貼圖烘焙成功。
.. _class_LightmapGI_constant_BAKE_ERROR_NO_SCENE_ROOT:
.. rst-class:: classref-enumeration-constant
:ref:`BakeError<enum_LightmapGI_BakeError>` **BAKE_ERROR_NO_SCENE_ROOT** = ``1``
光照貼圖烘焙失敗,原因是無法存取所編輯場景的根節點。
.. _class_LightmapGI_constant_BAKE_ERROR_FOREIGN_DATA:
.. rst-class:: classref-enumeration-constant
:ref:`BakeError<enum_LightmapGI_BakeError>` **BAKE_ERROR_FOREIGN_DATA** = ``2``
光照貼圖烘焙失敗,原因是光照貼圖資料嵌入在外部資源之中。
.. _class_LightmapGI_constant_BAKE_ERROR_NO_LIGHTMAPPER:
.. rst-class:: classref-enumeration-constant
:ref:`BakeError<enum_LightmapGI_BakeError>` **BAKE_ERROR_NO_LIGHTMAPPER** = ``3``
光照貼圖烘焙失敗,原因是這個 Godot 建構中沒有可用的光照貼圖器。
.. _class_LightmapGI_constant_BAKE_ERROR_NO_SAVE_PATH:
.. rst-class:: classref-enumeration-constant
:ref:`BakeError<enum_LightmapGI_BakeError>` **BAKE_ERROR_NO_SAVE_PATH** = ``4``
光照貼圖烘焙失敗,原因是資源中沒有配置 :ref:`LightmapGIData<class_LightmapGIData>` 保存路徑。
.. _class_LightmapGI_constant_BAKE_ERROR_NO_MESHES:
.. rst-class:: classref-enumeration-constant
:ref:`BakeError<enum_LightmapGI_BakeError>` **BAKE_ERROR_NO_MESHES** = ``5``
光照貼圖烘焙失敗,原因是目前場景中沒有 :ref:`GeometryInstance3D.gi_mode<class_GeometryInstance3D_property_gi_mode>`:ref:`GeometryInstance3D.GI_MODE_STATIC<class_GeometryInstance3D_constant_GI_MODE_STATIC>` 且具有有效 UV2 對應的網格。可能需要在匯入停靠面板中選擇 3D 場景,並相應地更改它們的全域照明模式。
.. _class_LightmapGI_constant_BAKE_ERROR_MESHES_INVALID:
.. rst-class:: classref-enumeration-constant
:ref:`BakeError<enum_LightmapGI_BakeError>` **BAKE_ERROR_MESHES_INVALID** = ``6``
光照貼圖烘焙失敗,原因是光照貼圖器無法分析一些標記為靜態的網格以進行烘焙。
.. _class_LightmapGI_constant_BAKE_ERROR_CANT_CREATE_IMAGE:
.. rst-class:: classref-enumeration-constant
:ref:`BakeError<enum_LightmapGI_BakeError>` **BAKE_ERROR_CANT_CREATE_IMAGE** = ``7``
光照貼圖烘焙失敗,原因是最終的圖像無法保存,或保存後無法被 Godot 匯入。
.. _class_LightmapGI_constant_BAKE_ERROR_USER_ABORTED:
.. rst-class:: classref-enumeration-constant
:ref:`BakeError<enum_LightmapGI_BakeError>` **BAKE_ERROR_USER_ABORTED** = ``8``
使用者中止了光照貼圖烘焙操作(通常通過點擊進度對話方塊中的\ **取消**\ 按鈕)。
.. _class_LightmapGI_constant_BAKE_ERROR_TEXTURE_SIZE_TOO_SMALL:
.. rst-class:: classref-enumeration-constant
:ref:`BakeError<enum_LightmapGI_BakeError>` **BAKE_ERROR_TEXTURE_SIZE_TOO_SMALL** = ``9``
光照貼圖烘焙失敗,原因是光照貼圖器無法分析一些標記為靜態的網格以進行烘焙。
.. _class_LightmapGI_constant_BAKE_ERROR_LIGHTMAP_TOO_SMALL:
.. rst-class:: classref-enumeration-constant
:ref:`BakeError<enum_LightmapGI_BakeError>` **BAKE_ERROR_LIGHTMAP_TOO_SMALL** = ``10``
Lightmap baking failed as the lightmap is too small.
.. _class_LightmapGI_constant_BAKE_ERROR_ATLAS_TOO_SMALL:
.. rst-class:: classref-enumeration-constant
:ref:`BakeError<enum_LightmapGI_BakeError>` **BAKE_ERROR_ATLAS_TOO_SMALL** = ``11``
Lightmap baking failed as the lightmap was unable to fit into an atlas.
.. rst-class:: classref-item-separator
----
.. _enum_LightmapGI_EnvironmentMode:
.. rst-class:: classref-enumeration
enum **EnvironmentMode**: :ref:`🔗<enum_LightmapGI_EnvironmentMode>`
.. _class_LightmapGI_constant_ENVIRONMENT_MODE_DISABLED:
.. rst-class:: classref-enumeration-constant
:ref:`EnvironmentMode<enum_LightmapGI_EnvironmentMode>` **ENVIRONMENT_MODE_DISABLED** = ``0``
烘焙光照貼圖時忽略環境光照。
.. _class_LightmapGI_constant_ENVIRONMENT_MODE_SCENE:
.. rst-class:: classref-enumeration-constant
:ref:`EnvironmentMode<enum_LightmapGI_EnvironmentMode>` **ENVIRONMENT_MODE_SCENE** = ``1``
烘焙光照貼圖時,使用場景的環境光照。
\ **注意:**\ 如果在沒有 :ref:`WorldEnvironment<class_WorldEnvironment>` 節點的場景中烘焙光照貼圖,這將表現得像 :ref:`ENVIRONMENT_MODE_DISABLED<class_LightmapGI_constant_ENVIRONMENT_MODE_DISABLED>`\ 。在烘焙光照貼圖時,\ **LightmapGI** *不會*\ 考慮編輯器的預覽天空和太陽。
.. _class_LightmapGI_constant_ENVIRONMENT_MODE_CUSTOM_SKY:
.. rst-class:: classref-enumeration-constant
:ref:`EnvironmentMode<enum_LightmapGI_EnvironmentMode>` **ENVIRONMENT_MODE_CUSTOM_SKY** = ``2``
烘焙光照貼圖時,使用 :ref:`environment_custom_sky<class_LightmapGI_property_environment_custom_sky>` 作為環境光照來源。
.. _class_LightmapGI_constant_ENVIRONMENT_MODE_CUSTOM_COLOR:
.. rst-class:: classref-enumeration-constant
:ref:`EnvironmentMode<enum_LightmapGI_EnvironmentMode>` **ENVIRONMENT_MODE_CUSTOM_COLOR** = ``3``
烘焙光照貼圖時,使用 :ref:`environment_custom_color<class_LightmapGI_property_environment_custom_color>`:ref:`environment_custom_energy<class_LightmapGI_property_environment_custom_energy>` 相乘的結果作為環境光照的恒定來源。
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
屬性說明
--------
.. _class_LightmapGI_property_bias:
.. rst-class:: classref-property
:ref:`float<class_float>` **bias** = ``0.0005`` :ref:`🔗<class_LightmapGI_property_bias>`
.. rst-class:: classref-property-setget
- |void| **set_bias**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_bias**\ (\ )
計算陰影時使用的偏置。增加 :ref:`bias<class_LightmapGI_property_bias>` 可以修復生成的烘焙光照貼圖上的陰影失真,但會引入陰影懸浮(陰影未連接到其障礙物)。即時 :ref:`Light3D<class_Light3D>` 陰影不受該 :ref:`bias<class_LightmapGI_property_bias>` 屬性的影響。
.. rst-class:: classref-item-separator
----
.. _class_LightmapGI_property_bounce_indirect_energy:
.. rst-class:: classref-property
:ref:`float<class_float>` **bounce_indirect_energy** = ``1.0`` :ref:`🔗<class_LightmapGI_property_bounce_indirect_energy>`
.. rst-class:: classref-property-setget
- |void| **set_bounce_indirect_energy**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_bounce_indirect_energy**\ (\ )
The energy multiplier for each bounce. Higher values will make indirect lighting brighter. A value of ``1.0`` represents physically accurate behavior, but higher values can be used to make indirect lighting propagate more visibly when using a low number of bounces. This can be used to speed up bake times by lowering the number of :ref:`bounces<class_LightmapGI_property_bounces>` then increasing :ref:`bounce_indirect_energy<class_LightmapGI_property_bounce_indirect_energy>`.
\ **Note:** :ref:`bounce_indirect_energy<class_LightmapGI_property_bounce_indirect_energy>` only has an effect if :ref:`bounces<class_LightmapGI_property_bounces>` is set to a value greater than or equal to ``1``.
.. rst-class:: classref-item-separator
----
.. _class_LightmapGI_property_bounces:
.. rst-class:: classref-property
:ref:`int<class_int>` **bounces** = ``3`` :ref:`🔗<class_LightmapGI_property_bounces>`
.. rst-class:: classref-property-setget
- |void| **set_bounces**\ (\ value\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_bounces**\ (\ )
烘焙過程中考慮的光反彈次數。較高的值會產生更明亮、更逼真的光線,但代價是更長的烘焙時間。如果設定為 ``0``\ ,則僅烘焙環境光線、直接光線和自發光光線。
.. rst-class:: classref-item-separator
----
.. _class_LightmapGI_property_camera_attributes:
.. rst-class:: classref-property
:ref:`CameraAttributes<class_CameraAttributes>` **camera_attributes** :ref:`🔗<class_LightmapGI_property_camera_attributes>`
.. rst-class:: classref-property-setget
- |void| **set_camera_attributes**\ (\ value\: :ref:`CameraAttributes<class_CameraAttributes>`\ )
- :ref:`CameraAttributes<class_CameraAttributes>` **get_camera_attributes**\ (\ )
:ref:`CameraAttributes<class_CameraAttributes>` 資源,指定要烘焙的曝光級別。自動曝光和非曝光屬性將被忽略。應該使用曝光設定來減少烘焙時出現的動態範圍。如果曝光度太高,\ **LightmapGI** 將出現帶狀偽影,或可能出現過度曝光偽影。
.. rst-class:: classref-item-separator
----
.. _class_LightmapGI_property_denoiser_range:
.. rst-class:: classref-property
:ref:`int<class_int>` **denoiser_range** = ``10`` :ref:`🔗<class_LightmapGI_property_denoiser_range>`
.. rst-class:: classref-property-setget
- |void| **set_denoiser_range**\ (\ value\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_denoiser_range**\ (\ )
The distance in pixels from which the denoiser samples. Lower values preserve more details, but may give blotchy results if the lightmap quality is not high enough. Only effective if :ref:`use_denoiser<class_LightmapGI_property_use_denoiser>` is ``true`` and :ref:`ProjectSettings.rendering/lightmapping/denoising/denoiser<class_ProjectSettings_property_rendering/lightmapping/denoising/denoiser>` is set to JNLM.
.. rst-class:: classref-item-separator
----
.. _class_LightmapGI_property_denoiser_strength:
.. rst-class:: classref-property
:ref:`float<class_float>` **denoiser_strength** = ``0.1`` :ref:`🔗<class_LightmapGI_property_denoiser_strength>`
.. rst-class:: classref-property-setget
- |void| **set_denoiser_strength**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_denoiser_strength**\ (\ )
The strength of denoising step applied to the generated lightmaps. Only effective if :ref:`use_denoiser<class_LightmapGI_property_use_denoiser>` is ``true`` and :ref:`ProjectSettings.rendering/lightmapping/denoising/denoiser<class_ProjectSettings_property_rendering/lightmapping/denoising/denoiser>` is set to JNLM.
.. rst-class:: classref-item-separator
----
.. _class_LightmapGI_property_directional:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **directional** = ``false`` :ref:`🔗<class_LightmapGI_property_directional>`
.. rst-class:: classref-property-setget
- |void| **set_directional**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_directional**\ (\ )
If ``true``, bakes lightmaps to contain directional information as spherical harmonics. This results in more realistic lighting appearance, especially with normal mapped materials and for lights that have their direct light baked (:ref:`Light3D.light_bake_mode<class_Light3D_property_light_bake_mode>` set to :ref:`Light3D.BAKE_STATIC<class_Light3D_constant_BAKE_STATIC>` and with :ref:`Light3D.editor_only<class_Light3D_property_editor_only>` set to ``false``). The directional information is also used to provide rough reflections for static and dynamic objects. This has a small run-time performance cost as the shader has to perform more work to interpret the direction information from the lightmap. Directional lightmaps also take longer to bake and result in larger file sizes.
\ **Note:** The property's name has no relationship with :ref:`DirectionalLight3D<class_DirectionalLight3D>`. :ref:`directional<class_LightmapGI_property_directional>` works with all light types.
.. rst-class:: classref-item-separator
----
.. _class_LightmapGI_property_environment_custom_color:
.. rst-class:: classref-property
:ref:`Color<class_Color>` **environment_custom_color** = ``Color(1, 1, 1, 1)`` :ref:`🔗<class_LightmapGI_property_environment_custom_color>`
.. rst-class:: classref-property-setget
- |void| **set_environment_custom_color**\ (\ value\: :ref:`Color<class_Color>`\ )
- :ref:`Color<class_Color>` **get_environment_custom_color**\ (\ )
用於環境照明的顏色。僅在 :ref:`environment_mode<class_LightmapGI_property_environment_mode>`:ref:`ENVIRONMENT_MODE_CUSTOM_COLOR<class_LightmapGI_constant_ENVIRONMENT_MODE_CUSTOM_COLOR>` 時有效。
.. rst-class:: classref-item-separator
----
.. _class_LightmapGI_property_environment_custom_energy:
.. rst-class:: classref-property
:ref:`float<class_float>` **environment_custom_energy** = ``1.0`` :ref:`🔗<class_LightmapGI_property_environment_custom_energy>`
.. rst-class:: classref-property-setget
- |void| **set_environment_custom_energy**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_environment_custom_energy**\ (\ )
用於環境照明的顏色倍數。僅在 :ref:`environment_mode<class_LightmapGI_property_environment_mode>`:ref:`ENVIRONMENT_MODE_CUSTOM_COLOR<class_LightmapGI_constant_ENVIRONMENT_MODE_CUSTOM_COLOR>` 時有效。
.. rst-class:: classref-item-separator
----
.. _class_LightmapGI_property_environment_custom_sky:
.. rst-class:: classref-property
:ref:`Sky<class_Sky>` **environment_custom_sky** :ref:`🔗<class_LightmapGI_property_environment_custom_sky>`
.. rst-class:: classref-property-setget
- |void| **set_environment_custom_sky**\ (\ value\: :ref:`Sky<class_Sky>`\ )
- :ref:`Sky<class_Sky>` **get_environment_custom_sky**\ (\ )
用作環境照明光源的天空。僅在 :ref:`environment_mode<class_LightmapGI_property_environment_mode>`:ref:`ENVIRONMENT_MODE_CUSTOM_SKY<class_LightmapGI_constant_ENVIRONMENT_MODE_CUSTOM_SKY>` 時有效。
.. rst-class:: classref-item-separator
----
.. _class_LightmapGI_property_environment_mode:
.. rst-class:: classref-property
:ref:`EnvironmentMode<enum_LightmapGI_EnvironmentMode>` **environment_mode** = ``1`` :ref:`🔗<class_LightmapGI_property_environment_mode>`
.. rst-class:: classref-property-setget
- |void| **set_environment_mode**\ (\ value\: :ref:`EnvironmentMode<enum_LightmapGI_EnvironmentMode>`\ )
- :ref:`EnvironmentMode<enum_LightmapGI_EnvironmentMode>` **get_environment_mode**\ (\ )
烘焙光照貼圖時使用的環境模式。
.. rst-class:: classref-item-separator
----
.. _class_LightmapGI_property_generate_probes_subdiv:
.. rst-class:: classref-property
:ref:`GenerateProbes<enum_LightmapGI_GenerateProbes>` **generate_probes_subdiv** = ``2`` :ref:`🔗<class_LightmapGI_property_generate_probes_subdiv>`
.. rst-class:: classref-property-setget
- |void| **set_generate_probes**\ (\ value\: :ref:`GenerateProbes<enum_LightmapGI_GenerateProbes>`\ )
- :ref:`GenerateProbes<enum_LightmapGI_GenerateProbes>` **get_generate_probes**\ (\ )
為動態物件照明自動生成 :ref:`LightmapProbe<class_LightmapProbe>` 時使用的細分級別。較高的值會在動態物件上產生更準確的間接照明,但代價是更長的烘焙時間和更大的檔大小。
\ **注意:**\ 自動生成的 :ref:`LightmapProbe<class_LightmapProbe>`\ ,不作為在場景樹停靠面板中的節點可見,並且生成後無法通過這種方式修改。
\ **注意:**\ 不管 :ref:`generate_probes_subdiv<class_LightmapGI_property_generate_probes_subdiv>`\ ,動態物件上的直接光照,總是使用 :ref:`Light3D<class_Light3D>` 節點即時套用。
.. rst-class:: classref-item-separator
----
.. _class_LightmapGI_property_interior:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **interior** = ``false`` :ref:`🔗<class_LightmapGI_property_interior>`
.. rst-class:: classref-property-setget
- |void| **set_interior**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_interior**\ (\ )
如果為 ``true``\ ,則會在烘焙光照貼圖時忽略環境光照。
.. rst-class:: classref-item-separator
----
.. _class_LightmapGI_property_light_data:
.. rst-class:: classref-property
:ref:`LightmapGIData<class_LightmapGIData>` **light_data** :ref:`🔗<class_LightmapGI_property_light_data>`
.. rst-class:: classref-property-setget
- |void| **set_light_data**\ (\ value\: :ref:`LightmapGIData<class_LightmapGIData>`\ )
- :ref:`LightmapGIData<class_LightmapGIData>` **get_light_data**\ (\ )
與該 **LightmapGI** 節點關聯的 :ref:`LightmapGIData<class_LightmapGIData>`\ 。該資源是在烘焙後自動建立的,並不意味著要手動建立。
.. rst-class:: classref-item-separator
----
.. _class_LightmapGI_property_max_texture_size:
.. rst-class:: classref-property
:ref:`int<class_int>` **max_texture_size** = ``16384`` :ref:`🔗<class_LightmapGI_property_max_texture_size>`
.. rst-class:: classref-property-setget
- |void| **set_max_texture_size**\ (\ value\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_max_texture_size**\ (\ )
生成的紋理合集的最大紋理大小。更高的值將導致生成的切片更少,但由於硬體對紋理大小的限制,可能無法在所有硬體上工作。如果不確定,請將 :ref:`max_texture_size<class_LightmapGI_property_max_texture_size>` 保留為其預設值 ``16384``\ 。
.. rst-class:: classref-item-separator
----
.. _class_LightmapGI_property_quality:
.. rst-class:: classref-property
:ref:`BakeQuality<enum_LightmapGI_BakeQuality>` **quality** = ``1`` :ref:`🔗<class_LightmapGI_property_quality>`
.. rst-class:: classref-property-setget
- |void| **set_bake_quality**\ (\ value\: :ref:`BakeQuality<enum_LightmapGI_BakeQuality>`\ )
- :ref:`BakeQuality<enum_LightmapGI_BakeQuality>` **get_bake_quality**\ (\ )
The quality preset to use when baking lightmaps. This affects bake times, but output file sizes remain mostly identical across quality levels.
To further speed up bake times, decrease :ref:`bounces<class_LightmapGI_property_bounces>`, disable :ref:`use_denoiser<class_LightmapGI_property_use_denoiser>` and/or decrease :ref:`texel_scale<class_LightmapGI_property_texel_scale>`.
To further increase quality, enable :ref:`supersampling<class_LightmapGI_property_supersampling>` and/or increase :ref:`texel_scale<class_LightmapGI_property_texel_scale>`.
.. rst-class:: classref-item-separator
----
.. _class_LightmapGI_property_shadowmask_mode:
.. rst-class:: classref-property
:ref:`ShadowmaskMode<enum_LightmapGIData_ShadowmaskMode>` **shadowmask_mode** = ``0`` :ref:`🔗<class_LightmapGI_property_shadowmask_mode>`
.. rst-class:: classref-property-setget
- |void| **set_shadowmask_mode**\ (\ value\: :ref:`ShadowmaskMode<enum_LightmapGIData_ShadowmaskMode>`\ )
- :ref:`ShadowmaskMode<enum_LightmapGIData_ShadowmaskMode>` **get_shadowmask_mode**\ (\ )
**實驗性:** 此屬性可能在未來版本中變更或移除。
The shadowmasking policy to use for directional shadows on static objects that are baked with this **LightmapGI** instance.
Shadowmasking allows :ref:`DirectionalLight3D<class_DirectionalLight3D>` nodes to cast shadows even outside the range defined by their :ref:`DirectionalLight3D.directional_shadow_max_distance<class_DirectionalLight3D_property_directional_shadow_max_distance>` property. This is done by baking a texture that contains a shadowmap for the directional light, then using this texture according to the current shadowmask mode.
\ **Note:** The shadowmask texture is only created if :ref:`shadowmask_mode<class_LightmapGI_property_shadowmask_mode>` is not :ref:`LightmapGIData.SHADOWMASK_MODE_NONE<class_LightmapGIData_constant_SHADOWMASK_MODE_NONE>`. To see a difference, you need to bake lightmaps again after switching from :ref:`LightmapGIData.SHADOWMASK_MODE_NONE<class_LightmapGIData_constant_SHADOWMASK_MODE_NONE>` to any other mode.
.. rst-class:: classref-item-separator
----
.. _class_LightmapGI_property_supersampling:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **supersampling** = ``false`` :ref:`🔗<class_LightmapGI_property_supersampling>`
.. rst-class:: classref-property-setget
- |void| **set_supersampling_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_supersampling_enabled**\ (\ )
If ``true``, lightmaps are baked with the texel scale multiplied with :ref:`supersampling_factor<class_LightmapGI_property_supersampling_factor>` and downsampled before saving the lightmap (so the effective texel density is identical to having supersampling disabled).
Supersampling provides increased lightmap quality with less noise, smoother shadows and better shadowing of small-scale features in objects. However, it may result in significantly increased bake times and memory usage while baking lightmaps. Padding is automatically adjusted to avoid increasing light leaking.
.. rst-class:: classref-item-separator
----
.. _class_LightmapGI_property_supersampling_factor:
.. rst-class:: classref-property
:ref:`float<class_float>` **supersampling_factor** = ``2.0`` :ref:`🔗<class_LightmapGI_property_supersampling_factor>`
.. rst-class:: classref-property-setget
- |void| **set_supersampling_factor**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_supersampling_factor**\ (\ )
The factor by which the texel density is multiplied for supersampling. For best results, use an integer value. While fractional values are allowed, they can result in increased light leaking and a blurry lightmap.
Higher values may result in better quality, but also increase bake times and memory usage while baking.
See :ref:`supersampling<class_LightmapGI_property_supersampling>` for more information.
.. rst-class:: classref-item-separator
----
.. _class_LightmapGI_property_texel_scale:
.. rst-class:: classref-property
:ref:`float<class_float>` **texel_scale** = ``1.0`` :ref:`🔗<class_LightmapGI_property_texel_scale>`
.. rst-class:: classref-property-setget
- |void| **set_texel_scale**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_texel_scale**\ (\ )
Scales the lightmap texel density of all meshes for the current bake. This is a multiplier that builds upon the existing lightmap texel size defined in each imported 3D scene, along with the per-mesh density multiplier (which is designed to be used when the same mesh is used at different scales). Lower values will result in faster bake times.
For example, doubling :ref:`texel_scale<class_LightmapGI_property_texel_scale>` doubles the lightmap texture resolution for all objects *on each axis*, so it will *quadruple* the texel count.
.. rst-class:: classref-item-separator
----
.. _class_LightmapGI_property_use_denoiser:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **use_denoiser** = ``true`` :ref:`🔗<class_LightmapGI_property_use_denoiser>`
.. rst-class:: classref-property-setget
- |void| **set_use_denoiser**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_using_denoiser**\ (\ )
如果為 ``true``\ ,則在生成的光照貼圖上,使用基於 CPU 的降噪演算法。這以更長的烘焙時間為代價,消除了生成的光照貼圖中的大部分噪點。儘管無失真壓縮在壓縮降噪圖像方面可能做得更好,但使用降噪器通常不會顯著影響檔大小。
\ **注意:**\ 在大場景中對光照貼圖進行降噪時內建降噪器OpenImageDenoise可能會當機。如果在光照貼圖烘焙結束時遇到當機請嘗試禁用 :ref:`use_denoiser<class_LightmapGI_property_use_denoiser>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_LightmapGI_property_use_texture_for_bounces:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **use_texture_for_bounces** = ``true`` :ref:`🔗<class_LightmapGI_property_use_texture_for_bounces>`
.. rst-class:: classref-property-setget
- |void| **set_use_texture_for_bounces**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_using_texture_for_bounces**\ (\ )
If ``true``, a texture with the lighting information will be generated to speed up the generation of indirect lighting at the cost of some accuracy. The geometry might exhibit extra light leak artifacts when using low resolution lightmaps or UVs that stretch the lightmap significantly across surfaces. Leave :ref:`use_texture_for_bounces<class_LightmapGI_property_use_texture_for_bounces>` at its default value of ``true`` if unsure.
\ **Note:** :ref:`use_texture_for_bounces<class_LightmapGI_property_use_texture_for_bounces>` only has an effect if :ref:`bounces<class_LightmapGI_property_bounces>` is set to a value greater than or equal to ``1``.
.. |virtual| replace:: :abbr:`virtual (本方法通常需要使用者覆寫才能生效。)`
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
.. |const| replace:: :abbr:`const (本方法沒有副作用。不會修改該實例的任何成員變數。)`
.. |vararg| replace:: :abbr:`vararg (本方法除了這裡描述的參數外,還可以接受任意數量的參數。)`
.. |constructor| replace:: :abbr:`constructor (本方法用於建構一個型別。)`
.. |static| replace:: :abbr:`static (本方法無需實例即可呼叫,因此可以直接使用類別名稱呼叫。)`
.. |operator| replace:: :abbr:`operator (本方法描述將本型別作為左運算元時可用的有效運算子。)`
.. |bitfield| replace:: :abbr:`BitField (此值是由下列旗標組成的位元遮罩整數。)`
.. |void| replace:: :abbr:`void (無回傳值。)`