Files
godot-docs-l10n/classes/zh_Hans/class_voxelgidata.rst

312 lines
20 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_VoxelGIData:
VoxelGIData
===========
**继承:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
包含用于 :ref:`VoxelGI<class_VoxelGI>` 节点的烘焙体素全局光照数据。
.. rst-class:: classref-introduction-group
描述
----
**VoxelGIData** 包含烘焙的体素全局照明,用于 :ref:`VoxelGI<class_VoxelGI>` 节点。\ **VoxelGIData** 还提供了若干用来调整全局照明最终外观的属性。这些属性可以在运行时调整,无须再次烘焙 :ref:`VoxelGI<class_VoxelGI>` 节点。
\ **注意:**\ 为了防止基于文本的场景文件(\ ``.tscn``\ )过度增长,导致加载和保存速度变慢,请始终将 **VoxelGIData** 保存为外部二进制资源文件(\ ``.res``\ ),不要将其嵌入到场景中。做法是点击 **VoxelGIData** 资源旁边的下拉箭头,选择\ **编辑**\ ,点击检查器顶部的软盘图标,然后选择\ **另存为...**\ 。
.. rst-class:: classref-introduction-group
教程
----
- `第三人称射击TPS演示 <https://godotengine.org/asset-library/asset/2710>`__
.. rst-class:: classref-reftable-group
属性
----
.. table::
:widths: auto
+---------------------------+--------------------------------------------------------------------+-----------+
| :ref:`float<class_float>` | :ref:`bias<class_VoxelGIData_property_bias>` | ``1.5`` |
+---------------------------+--------------------------------------------------------------------+-----------+
| :ref:`float<class_float>` | :ref:`dynamic_range<class_VoxelGIData_property_dynamic_range>` | ``2.0`` |
+---------------------------+--------------------------------------------------------------------+-----------+
| :ref:`float<class_float>` | :ref:`energy<class_VoxelGIData_property_energy>` | ``1.0`` |
+---------------------------+--------------------------------------------------------------------+-----------+
| :ref:`bool<class_bool>` | :ref:`interior<class_VoxelGIData_property_interior>` | ``false`` |
+---------------------------+--------------------------------------------------------------------+-----------+
| :ref:`float<class_float>` | :ref:`normal_bias<class_VoxelGIData_property_normal_bias>` | ``0.0`` |
+---------------------------+--------------------------------------------------------------------+-----------+
| :ref:`float<class_float>` | :ref:`propagation<class_VoxelGIData_property_propagation>` | ``0.5`` |
+---------------------------+--------------------------------------------------------------------+-----------+
| :ref:`bool<class_bool>` | :ref:`use_two_bounces<class_VoxelGIData_property_use_two_bounces>` | ``true`` |
+---------------------------+--------------------------------------------------------------------+-----------+
.. rst-class:: classref-reftable-group
方法
----
.. table::
:widths: auto
+-------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`allocate<class_VoxelGIData_method_allocate>`\ (\ to_cell_xform\: :ref:`Transform3D<class_Transform3D>`, aabb\: :ref:`AABB<class_AABB>`, octree_size\: :ref:`Vector3<class_Vector3>`, octree_cells\: :ref:`PackedByteArray<class_PackedByteArray>`, data_cells\: :ref:`PackedByteArray<class_PackedByteArray>`, distance_field\: :ref:`PackedByteArray<class_PackedByteArray>`, level_counts\: :ref:`PackedInt32Array<class_PackedInt32Array>`\ ) |
+-------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`AABB<class_AABB>` | :ref:`get_bounds<class_VoxelGIData_method_get_bounds>`\ (\ ) |const| |
+-------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PackedByteArray<class_PackedByteArray>` | :ref:`get_data_cells<class_VoxelGIData_method_get_data_cells>`\ (\ ) |const| |
+-------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PackedInt32Array<class_PackedInt32Array>` | :ref:`get_level_counts<class_VoxelGIData_method_get_level_counts>`\ (\ ) |const| |
+-------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`PackedByteArray<class_PackedByteArray>` | :ref:`get_octree_cells<class_VoxelGIData_method_get_octree_cells>`\ (\ ) |const| |
+-------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector3<class_Vector3>` | :ref:`get_octree_size<class_VoxelGIData_method_get_octree_size>`\ (\ ) |const| |
+-------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Transform3D<class_Transform3D>` | :ref:`get_to_cell_xform<class_VoxelGIData_method_get_to_cell_xform>`\ (\ ) |const| |
+-------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
属性说明
--------
.. _class_VoxelGIData_property_bias:
.. rst-class:: classref-property
:ref:`float<class_float>` **bias** = ``1.5`` :ref:`🔗<class_VoxelGIData_property_bias>`
.. rst-class:: classref-property-setget
- |void| **set_bias**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_bias**\ (\ )
间接光照和反射所使用的法线偏移。较高的值可以减少非粗糙材质中可见的自反射,但会增加光线泄漏并让间接光照看上去更扁平。如果要优先隐藏自反射而不是追求光照质量,请将 :ref:`bias<class_VoxelGIData_property_bias>` 设为 ``0.0``\ ,并将 :ref:`normal_bias<class_VoxelGIData_property_normal_bias>` 设为 ``1.0````2.0`` 之间的值。
.. rst-class:: classref-item-separator
----
.. _class_VoxelGIData_property_dynamic_range:
.. rst-class:: classref-property
:ref:`float<class_float>` **dynamic_range** = ``2.0`` :ref:`🔗<class_VoxelGIData_property_dynamic_range>`
.. rst-class:: classref-property-setget
- |void| **set_dynamic_range**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_dynamic_range**\ (\ )
要使用的动态范围(\ ``1.0`` 代表低动态范围场景亮度)。较高的值可用于提供更明亮的间接光照,但会在较暗的区域产生更多可见的色带效果(包括间接光照和反射)。为了避免色带效果,建议将其设置得尽可能低,避免出现明显的亮度截断。
.. rst-class:: classref-item-separator
----
.. _class_VoxelGIData_property_energy:
.. rst-class:: classref-property
:ref:`float<class_float>` **energy** = ``1.0`` :ref:`🔗<class_VoxelGIData_property_energy>`
.. rst-class:: classref-property-setget
- |void| **set_energy**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_energy**\ (\ )
:ref:`VoxelGI<class_VoxelGI>` 节点产生的间接照明和反射的能量。值越高,间接照明越亮。如果间接照明看起来过于平坦,请尝试减少 :ref:`propagation<class_VoxelGIData_property_propagation>`\ ,同时增加 :ref:`energy<class_VoxelGIData_property_energy>`\ 。另见影响间接照明有效亮度的 :ref:`use_two_bounces<class_VoxelGIData_property_use_two_bounces>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_VoxelGIData_property_interior:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **interior** = ``false`` :ref:`🔗<class_VoxelGIData_property_interior>`
.. rst-class:: classref-property-setget
- |void| **set_interior**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_interior**\ (\ )
如果为 ``true``\ ,则 :ref:`VoxelGI<class_VoxelGI>` 节点会忽略 :ref:`Environment<class_Environment>` 光照。如果为 ``false``\ ,则 :ref:`VoxelGI<class_VoxelGI>` 节点会考虑 :ref:`Environment<class_Environment>` 光照。\ :ref:`Environment<class_Environment>` 光照会实时更新,这意味着无需再次烘焙 :ref:`VoxelGI<class_VoxelGI>` 节点即可对其进行更改。
.. rst-class:: classref-item-separator
----
.. _class_VoxelGIData_property_normal_bias:
.. rst-class:: classref-property
:ref:`float<class_float>` **normal_bias** = ``0.0`` :ref:`🔗<class_VoxelGIData_property_normal_bias>`
.. rst-class:: classref-property-setget
- |void| **set_normal_bias**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_normal_bias**\ (\ )
用于间接照明和反射的法线偏置。较高的值能够减少在非粗糙材质中可见的自反射,但会导致更多可见的漏光问题,间接照明看起来也会更平坦。另见 :ref:`bias<class_VoxelGIData_property_bias>`\ 。要优先隐藏自反射,而不是提高照明质量,请将 :ref:`bias<class_VoxelGIData_property_bias>` 设置为 ``0.0``\ ,并将 :ref:`normal_bias<class_VoxelGIData_property_normal_bias>` 设置为介于 ``1.0````2.0`` 之间的值。
.. rst-class:: classref-item-separator
----
.. _class_VoxelGIData_property_propagation:
.. rst-class:: classref-property
:ref:`float<class_float>` **propagation** = ``0.5`` :ref:`🔗<class_VoxelGIData_property_propagation>`
.. rst-class:: classref-property-setget
- |void| **set_propagation**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_propagation**\ (\ )
当光线从表面反弹时使用的乘数。较高的值会导致更亮的间接照明。如果间接照明看起来过于平坦,请尝试减少 :ref:`propagation<class_VoxelGIData_property_propagation>` 同时增加 :ref:`energy<class_VoxelGIData_property_energy>`\ 。另见影响间接照明的有效亮度的 :ref:`use_two_bounces<class_VoxelGIData_property_use_two_bounces>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_VoxelGIData_property_use_two_bounces:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **use_two_bounces** = ``true`` :ref:`🔗<class_VoxelGIData_property_use_two_bounces>`
.. rst-class:: classref-property-setget
- |void| **set_use_two_bounces**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_using_two_bounces**\ (\ )
如果为 ``true``\ ,则执行两次间接照明反弹而不是一次。这使得以一个较低的性能成本,使间接照明看起来更自然、更明亮。第二次反弹在反射中也是可见的。如果启用 :ref:`use_two_bounces<class_VoxelGIData_property_use_two_bounces>` 后场景显得太亮,请调整 :ref:`propagation<class_VoxelGIData_property_propagation>` 和 :ref:`energy<class_VoxelGIData_property_energy>`\ 。
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
方法说明
--------
.. _class_VoxelGIData_method_allocate:
.. rst-class:: classref-method
|void| **allocate**\ (\ to_cell_xform\: :ref:`Transform3D<class_Transform3D>`, aabb\: :ref:`AABB<class_AABB>`, octree_size\: :ref:`Vector3<class_Vector3>`, octree_cells\: :ref:`PackedByteArray<class_PackedByteArray>`, data_cells\: :ref:`PackedByteArray<class_PackedByteArray>`, distance_field\: :ref:`PackedByteArray<class_PackedByteArray>`, level_counts\: :ref:`PackedInt32Array<class_PackedInt32Array>`\ ) :ref:`🔗<class_VoxelGIData_method_allocate>`
.. container:: contribute
There is currently no description for this method. Please help us by `contributing one <https://contributing.godotengine.org/en/latest/documentation/class_reference.html>`__!
.. rst-class:: classref-item-separator
----
.. _class_VoxelGIData_method_get_bounds:
.. rst-class:: classref-method
:ref:`AABB<class_AABB>` **get_bounds**\ (\ ) |const| :ref:`🔗<class_VoxelGIData_method_get_bounds>`
返回一个 :ref:`AABB<class_AABB>`\ ,表示已烘焙体素数据的边界,烘焙后应该与 :ref:`VoxelGI.size<class_VoxelGI_property_size>` 相匹配(仅包含表示大小的 :ref:`Vector3<class_Vector3>`\ )。
\ **注意:**\ 如果修改了大小但没有对 VoxelGI 数据进行烘焙,则 :ref:`get_bounds()<class_VoxelGIData_method_get_bounds>` 和 :ref:`VoxelGI.size<class_VoxelGI_property_size>` 的值将不匹配。
.. rst-class:: classref-item-separator
----
.. _class_VoxelGIData_method_get_data_cells:
.. rst-class:: classref-method
:ref:`PackedByteArray<class_PackedByteArray>` **get_data_cells**\ (\ ) |const| :ref:`🔗<class_VoxelGIData_method_get_data_cells>`
.. container:: contribute
There is currently no description for this method. Please help us by `contributing one <https://contributing.godotengine.org/en/latest/documentation/class_reference.html>`__!
.. rst-class:: classref-item-separator
----
.. _class_VoxelGIData_method_get_level_counts:
.. rst-class:: classref-method
:ref:`PackedInt32Array<class_PackedInt32Array>` **get_level_counts**\ (\ ) |const| :ref:`🔗<class_VoxelGIData_method_get_level_counts>`
.. container:: contribute
There is currently no description for this method. Please help us by `contributing one <https://contributing.godotengine.org/en/latest/documentation/class_reference.html>`__!
.. rst-class:: classref-item-separator
----
.. _class_VoxelGIData_method_get_octree_cells:
.. rst-class:: classref-method
:ref:`PackedByteArray<class_PackedByteArray>` **get_octree_cells**\ (\ ) |const| :ref:`🔗<class_VoxelGIData_method_get_octree_cells>`
.. container:: contribute
There is currently no description for this method. Please help us by `contributing one <https://contributing.godotengine.org/en/latest/documentation/class_reference.html>`__!
.. rst-class:: classref-item-separator
----
.. _class_VoxelGIData_method_get_octree_size:
.. rst-class:: classref-method
:ref:`Vector3<class_Vector3>` **get_octree_size**\ (\ ) |const| :ref:`🔗<class_VoxelGIData_method_get_octree_size>`
.. container:: contribute
There is currently no description for this method. Please help us by `contributing one <https://contributing.godotengine.org/en/latest/documentation/class_reference.html>`__!
.. rst-class:: classref-item-separator
----
.. _class_VoxelGIData_method_get_to_cell_xform:
.. rst-class:: classref-method
:ref:`Transform3D<class_Transform3D>` **get_to_cell_xform**\ (\ ) |const| :ref:`🔗<class_VoxelGIData_method_get_to_cell_xform>`
.. container:: contribute
There is currently no description for this method. Please help us by `contributing one <https://contributing.godotengine.org/en/latest/documentation/class_reference.html>`__!
.. |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 (无返回值。)`