mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2026-01-04 10:09:56 +03:00
Currently including `zh_CN` and `es` which both have very high completion ratios. Others will be added once they reach a significant percentage too. These RST files will be used by godot-docs in place of its `classes` folder after we sync with https://github.com/godotengine/godot-docs/pull/5458. The update workflow is manual for now (example for `zh_CN`): - Build `godotengine/godot` in the branch we currently track (now `3.x`) - Run `godot --doctool -l zh_CN` - Run `cd doc && make rst LANGARG=zh_CN` - Copy `doc/_build/rst/*` to `classes/zh_CN/` here - Make sure to have `classes/zh_CN/index.rst` copied from `docs/classes`
414 lines
18 KiB
ReStructuredText
414 lines
18 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. Generated automatically by doc/tools/make_rst.py in Godot's source tree.
|
|
.. DO NOT EDIT THIS FILE, but the Light.xml source instead.
|
|
.. The source is found in doc/classes or modules/<name>/doc_classes.
|
|
|
|
.. _class_Light:
|
|
|
|
Light
|
|
=====
|
|
|
|
**Inherits:** :ref:`VisualInstance<class_VisualInstance>` **<** :ref:`CullInstance<class_CullInstance>` **<** :ref:`Spatial<class_Spatial>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
|
|
|
|
**Inherited By:** :ref:`DirectionalLight<class_DirectionalLight>`, :ref:`OmniLight<class_OmniLight>`, :ref:`SpotLight<class_SpotLight>`
|
|
|
|
Proporciona una clase base para diferentes tipos de nodos de luz.
|
|
|
|
Descripción
|
|
----------------------
|
|
|
|
Light is the *abstract* base class for light nodes. As it can't be instanced, it shouldn't be used directly. Other types of light nodes inherit from it. Light contains the common variables and parameters used for lighting.
|
|
|
|
Tutoriales
|
|
--------------------
|
|
|
|
- :doc:`3D lights and shadows <../tutorials/3d/lights_and_shadows>`
|
|
|
|
- `Third Person Shooter Demo <https://godotengine.org/asset-library/asset/678>`__
|
|
|
|
Propiedades
|
|
----------------------
|
|
|
|
+--------------------------------------+--------------------------------------------------------------------------------+-------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`editor_only<class_Light_property_editor_only>` | ``false`` |
|
|
+--------------------------------------+--------------------------------------------------------------------------------+-------------------------+
|
|
| :ref:`BakeMode<enum_Light_BakeMode>` | :ref:`light_bake_mode<class_Light_property_light_bake_mode>` | ``1`` |
|
|
+--------------------------------------+--------------------------------------------------------------------------------+-------------------------+
|
|
| :ref:`Color<class_Color>` | :ref:`light_color<class_Light_property_light_color>` | ``Color( 1, 1, 1, 1 )`` |
|
|
+--------------------------------------+--------------------------------------------------------------------------------+-------------------------+
|
|
| :ref:`int<class_int>` | :ref:`light_cull_mask<class_Light_property_light_cull_mask>` | ``4294967295`` |
|
|
+--------------------------------------+--------------------------------------------------------------------------------+-------------------------+
|
|
| :ref:`float<class_float>` | :ref:`light_energy<class_Light_property_light_energy>` | ``1.0`` |
|
|
+--------------------------------------+--------------------------------------------------------------------------------+-------------------------+
|
|
| :ref:`float<class_float>` | :ref:`light_indirect_energy<class_Light_property_light_indirect_energy>` | ``1.0`` |
|
|
+--------------------------------------+--------------------------------------------------------------------------------+-------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`light_negative<class_Light_property_light_negative>` | ``false`` |
|
|
+--------------------------------------+--------------------------------------------------------------------------------+-------------------------+
|
|
| :ref:`float<class_float>` | :ref:`light_size<class_Light_property_light_size>` | ``0.0`` |
|
|
+--------------------------------------+--------------------------------------------------------------------------------+-------------------------+
|
|
| :ref:`float<class_float>` | :ref:`light_specular<class_Light_property_light_specular>` | ``0.5`` |
|
|
+--------------------------------------+--------------------------------------------------------------------------------+-------------------------+
|
|
| :ref:`float<class_float>` | :ref:`shadow_bias<class_Light_property_shadow_bias>` | ``0.15`` |
|
|
+--------------------------------------+--------------------------------------------------------------------------------+-------------------------+
|
|
| :ref:`Color<class_Color>` | :ref:`shadow_color<class_Light_property_shadow_color>` | ``Color( 0, 0, 0, 1 )`` |
|
|
+--------------------------------------+--------------------------------------------------------------------------------+-------------------------+
|
|
| :ref:`float<class_float>` | :ref:`shadow_contact<class_Light_property_shadow_contact>` | ``0.0`` |
|
|
+--------------------------------------+--------------------------------------------------------------------------------+-------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`shadow_enabled<class_Light_property_shadow_enabled>` | ``false`` |
|
|
+--------------------------------------+--------------------------------------------------------------------------------+-------------------------+
|
|
| :ref:`bool<class_bool>` | :ref:`shadow_reverse_cull_face<class_Light_property_shadow_reverse_cull_face>` | ``false`` |
|
|
+--------------------------------------+--------------------------------------------------------------------------------+-------------------------+
|
|
|
|
Métodos
|
|
--------------
|
|
|
|
+---------------------------+----------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`get_param<class_Light_method_get_param>` **(** :ref:`Param<enum_Light_Param>` param **)** |const| |
|
|
+---------------------------+----------------------------------------------------------------------------------------------------------------------------------+
|
|
| void | :ref:`set_param<class_Light_method_set_param>` **(** :ref:`Param<enum_Light_Param>` param, :ref:`float<class_float>` value **)** |
|
|
+---------------------------+----------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
Enumeraciones
|
|
--------------------------
|
|
|
|
.. _enum_Light_Param:
|
|
|
|
.. _class_Light_constant_PARAM_ENERGY:
|
|
|
|
.. _class_Light_constant_PARAM_INDIRECT_ENERGY:
|
|
|
|
.. _class_Light_constant_PARAM_SIZE:
|
|
|
|
.. _class_Light_constant_PARAM_SPECULAR:
|
|
|
|
.. _class_Light_constant_PARAM_RANGE:
|
|
|
|
.. _class_Light_constant_PARAM_ATTENUATION:
|
|
|
|
.. _class_Light_constant_PARAM_SPOT_ANGLE:
|
|
|
|
.. _class_Light_constant_PARAM_SPOT_ATTENUATION:
|
|
|
|
.. _class_Light_constant_PARAM_CONTACT_SHADOW_SIZE:
|
|
|
|
.. _class_Light_constant_PARAM_SHADOW_MAX_DISTANCE:
|
|
|
|
.. _class_Light_constant_PARAM_SHADOW_SPLIT_1_OFFSET:
|
|
|
|
.. _class_Light_constant_PARAM_SHADOW_SPLIT_2_OFFSET:
|
|
|
|
.. _class_Light_constant_PARAM_SHADOW_SPLIT_3_OFFSET:
|
|
|
|
.. _class_Light_constant_PARAM_SHADOW_NORMAL_BIAS:
|
|
|
|
.. _class_Light_constant_PARAM_SHADOW_BIAS:
|
|
|
|
.. _class_Light_constant_PARAM_SHADOW_BIAS_SPLIT_SCALE:
|
|
|
|
.. _class_Light_constant_PARAM_MAX:
|
|
|
|
enum **Param**:
|
|
|
|
- **PARAM_ENERGY** = **0** --- Constante para acceder a :ref:`light_energy<class_Light_property_light_energy>`.
|
|
|
|
- **PARAM_INDIRECT_ENERGY** = **1** --- Constante para acceder a :ref:`light_indirect_energy<class_Light_property_light_indirect_energy>`.
|
|
|
|
- **PARAM_SIZE** = **2** --- Constante para el acceso a :ref:`light_size<class_Light_property_light_size>`.
|
|
|
|
- **PARAM_SPECULAR** = **3** --- Constante para acceder a :ref:`light_specular<class_Light_property_light_specular>`.
|
|
|
|
- **PARAM_RANGE** = **4** --- Constant for accessing :ref:`OmniLight.omni_range<class_OmniLight_property_omni_range>` or :ref:`SpotLight.spot_range<class_SpotLight_property_spot_range>`.
|
|
|
|
- **PARAM_ATTENUATION** = **5** --- Constant for accessing :ref:`OmniLight.omni_attenuation<class_OmniLight_property_omni_attenuation>` or :ref:`SpotLight.spot_attenuation<class_SpotLight_property_spot_attenuation>`.
|
|
|
|
- **PARAM_SPOT_ANGLE** = **6** --- Constant for accessing :ref:`SpotLight.spot_angle<class_SpotLight_property_spot_angle>`.
|
|
|
|
- **PARAM_SPOT_ATTENUATION** = **7** --- Constant for accessing :ref:`SpotLight.spot_angle_attenuation<class_SpotLight_property_spot_angle_attenuation>`.
|
|
|
|
- **PARAM_CONTACT_SHADOW_SIZE** = **8** --- Constant for accessing :ref:`shadow_contact<class_Light_property_shadow_contact>`.
|
|
|
|
- **PARAM_SHADOW_MAX_DISTANCE** = **9** --- Constant for accessing :ref:`DirectionalLight.directional_shadow_max_distance<class_DirectionalLight_property_directional_shadow_max_distance>`.
|
|
|
|
- **PARAM_SHADOW_SPLIT_1_OFFSET** = **10** --- Constant for accessing :ref:`DirectionalLight.directional_shadow_split_1<class_DirectionalLight_property_directional_shadow_split_1>`.
|
|
|
|
- **PARAM_SHADOW_SPLIT_2_OFFSET** = **11** --- Constant for accessing :ref:`DirectionalLight.directional_shadow_split_2<class_DirectionalLight_property_directional_shadow_split_2>`.
|
|
|
|
- **PARAM_SHADOW_SPLIT_3_OFFSET** = **12** --- Constant for accessing :ref:`DirectionalLight.directional_shadow_split_3<class_DirectionalLight_property_directional_shadow_split_3>`.
|
|
|
|
- **PARAM_SHADOW_NORMAL_BIAS** = **13** --- Constant for accessing :ref:`DirectionalLight.directional_shadow_normal_bias<class_DirectionalLight_property_directional_shadow_normal_bias>`.
|
|
|
|
- **PARAM_SHADOW_BIAS** = **14** --- Constante para acceder a :ref:`shadow_bias<class_Light_property_shadow_bias>`.
|
|
|
|
- **PARAM_SHADOW_BIAS_SPLIT_SCALE** = **15** --- Constant for accessing :ref:`DirectionalLight.directional_shadow_bias_split_scale<class_DirectionalLight_property_directional_shadow_bias_split_scale>`.
|
|
|
|
- **PARAM_MAX** = **16** --- Representa el tamaño del enum :ref:`Param<enum_Light_Param>`.
|
|
|
|
----
|
|
|
|
.. _enum_Light_BakeMode:
|
|
|
|
.. _class_Light_constant_BAKE_DISABLED:
|
|
|
|
.. _class_Light_constant_BAKE_INDIRECT:
|
|
|
|
.. _class_Light_constant_BAKE_ALL:
|
|
|
|
enum **BakeMode**:
|
|
|
|
- **BAKE_DISABLED** = **0** --- La luz es ignorada cuando se cocina.
|
|
|
|
\ **Nota**: Ocultar una luz *no* afecta al cocinado.
|
|
|
|
- **BAKE_INDIRECT** = **1** --- Sólo se cocinará la iluminación indirecta (por defecto).
|
|
|
|
- **BAKE_ALL** = **2** --- Tanto la luz directa como la indirecta serán cocinadas.
|
|
|
|
\ **Nota:** Debes ocultar la luz si no quieres que aparezca dos veces (dinámica y cocinada).
|
|
|
|
Descripciones de Propiedades
|
|
--------------------------------------------------------
|
|
|
|
.. _class_Light_property_editor_only:
|
|
|
|
- :ref:`bool<class_bool>` **editor_only**
|
|
|
|
+-----------+------------------------+
|
|
| *Default* | ``false`` |
|
|
+-----------+------------------------+
|
|
| *Setter* | set_editor_only(value) |
|
|
+-----------+------------------------+
|
|
| *Getter* | is_editor_only() |
|
|
+-----------+------------------------+
|
|
|
|
Si ``true``, la luz sólo aparece en el editor y no será visible en tiempo de ejecución.
|
|
|
|
----
|
|
|
|
.. _class_Light_property_light_bake_mode:
|
|
|
|
- :ref:`BakeMode<enum_Light_BakeMode>` **light_bake_mode**
|
|
|
|
+-----------+----------------------+
|
|
| *Default* | ``1`` |
|
|
+-----------+----------------------+
|
|
| *Setter* | set_bake_mode(value) |
|
|
+-----------+----------------------+
|
|
| *Getter* | get_bake_mode() |
|
|
+-----------+----------------------+
|
|
|
|
La luz está en modo cocinado. Ver :ref:`BakeMode<enum_Light_BakeMode>`.
|
|
|
|
----
|
|
|
|
.. _class_Light_property_light_color:
|
|
|
|
- :ref:`Color<class_Color>` **light_color**
|
|
|
|
+-----------+-------------------------+
|
|
| *Default* | ``Color( 1, 1, 1, 1 )`` |
|
|
+-----------+-------------------------+
|
|
| *Setter* | set_color(value) |
|
|
+-----------+-------------------------+
|
|
| *Getter* | get_color() |
|
|
+-----------+-------------------------+
|
|
|
|
El color de la luz. Un color *sobrebrillante* puede ser usado para lograr un resultado equivalente a incrementar la :ref:`light_energy<class_Light_property_light_energy>` de la luz.
|
|
|
|
----
|
|
|
|
.. _class_Light_property_light_cull_mask:
|
|
|
|
- :ref:`int<class_int>` **light_cull_mask**
|
|
|
|
+-----------+----------------------+
|
|
| *Default* | ``4294967295`` |
|
|
+-----------+----------------------+
|
|
| *Setter* | set_cull_mask(value) |
|
|
+-----------+----------------------+
|
|
| *Getter* | get_cull_mask() |
|
|
+-----------+----------------------+
|
|
|
|
La luz afectará a los objetos en las capas seleccionadas.
|
|
|
|
----
|
|
|
|
.. _class_Light_property_light_energy:
|
|
|
|
- :ref:`float<class_float>` **light_energy**
|
|
|
|
+-----------+------------------+
|
|
| *Default* | ``1.0`` |
|
|
+-----------+------------------+
|
|
| *Setter* | set_param(value) |
|
|
+-----------+------------------+
|
|
| *Getter* | get_param() |
|
|
+-----------+------------------+
|
|
|
|
The light's strength multiplier (this is not a physical unit). For :ref:`OmniLight<class_OmniLight>` and :ref:`SpotLight<class_SpotLight>`, changing this value will only change the light color's intensity, not the light's radius.
|
|
|
|
----
|
|
|
|
.. _class_Light_property_light_indirect_energy:
|
|
|
|
- :ref:`float<class_float>` **light_indirect_energy**
|
|
|
|
+-----------+------------------+
|
|
| *Default* | ``1.0`` |
|
|
+-----------+------------------+
|
|
| *Setter* | set_param(value) |
|
|
+-----------+------------------+
|
|
| *Getter* | get_param() |
|
|
+-----------+------------------+
|
|
|
|
Secondary multiplier used with indirect light (light bounces). This works on both :ref:`BakedLightmap<class_BakedLightmap>` and :ref:`GIProbe<class_GIProbe>`.
|
|
|
|
----
|
|
|
|
.. _class_Light_property_light_negative:
|
|
|
|
- :ref:`bool<class_bool>` **light_negative**
|
|
|
|
+-----------+---------------------+
|
|
| *Default* | ``false`` |
|
|
+-----------+---------------------+
|
|
| *Setter* | set_negative(value) |
|
|
+-----------+---------------------+
|
|
| *Getter* | is_negative() |
|
|
+-----------+---------------------+
|
|
|
|
Si ``true``, el efecto de la luz se invierte, oscureciendo áreas y proyectando sombras brillantes.
|
|
|
|
----
|
|
|
|
.. _class_Light_property_light_size:
|
|
|
|
- :ref:`float<class_float>` **light_size**
|
|
|
|
+-----------+------------------+
|
|
| *Default* | ``0.0`` |
|
|
+-----------+------------------+
|
|
| *Setter* | set_param(value) |
|
|
+-----------+------------------+
|
|
| *Getter* | get_param() |
|
|
+-----------+------------------+
|
|
|
|
The size of the light in Godot units. Only considered in baked lightmaps and only if :ref:`light_bake_mode<class_Light_property_light_bake_mode>` is set to :ref:`BAKE_ALL<class_Light_constant_BAKE_ALL>`. Increasing this value will make the shadows appear blurrier. This can be used to simulate area lights to an extent.
|
|
|
|
----
|
|
|
|
.. _class_Light_property_light_specular:
|
|
|
|
- :ref:`float<class_float>` **light_specular**
|
|
|
|
+-----------+------------------+
|
|
| *Default* | ``0.5`` |
|
|
+-----------+------------------+
|
|
| *Setter* | set_param(value) |
|
|
+-----------+------------------+
|
|
| *Getter* | get_param() |
|
|
+-----------+------------------+
|
|
|
|
La intensidad de la mancha especular en los objetos afectados por la luz. En ``0``, la luz se convierte en una luz difusa pura. Cuando no se emite, puede utilizarse para evitar reflejos poco realistas al colocar las luces sobre una superficie emisora.
|
|
|
|
----
|
|
|
|
.. _class_Light_property_shadow_bias:
|
|
|
|
- :ref:`float<class_float>` **shadow_bias**
|
|
|
|
+-----------+------------------+
|
|
| *Default* | ``0.15`` |
|
|
+-----------+------------------+
|
|
| *Setter* | set_param(value) |
|
|
+-----------+------------------+
|
|
| *Getter* | get_param() |
|
|
+-----------+------------------+
|
|
|
|
Se usa para ajustar la apariencia de las sombras. Un valor demasiado pequeño da como resultado una sombra propia ("shadow acne"), mientras que un valor demasiado grande hace que las sombras se separen de las ruedas ("peter-panning"). Ajústelo según sea necesario.
|
|
|
|
----
|
|
|
|
.. _class_Light_property_shadow_color:
|
|
|
|
- :ref:`Color<class_Color>` **shadow_color**
|
|
|
|
+-----------+-------------------------+
|
|
| *Default* | ``Color( 0, 0, 0, 1 )`` |
|
|
+-----------+-------------------------+
|
|
| *Setter* | set_shadow_color(value) |
|
|
+-----------+-------------------------+
|
|
| *Getter* | get_shadow_color() |
|
|
+-----------+-------------------------+
|
|
|
|
El color de las sombras proyectadas por esta luz.
|
|
|
|
----
|
|
|
|
.. _class_Light_property_shadow_contact:
|
|
|
|
- :ref:`float<class_float>` **shadow_contact**
|
|
|
|
+-----------+------------------+
|
|
| *Default* | ``0.0`` |
|
|
+-----------+------------------+
|
|
| *Setter* | set_param(value) |
|
|
+-----------+------------------+
|
|
| *Getter* | get_param() |
|
|
+-----------+------------------+
|
|
|
|
Attempts to reduce :ref:`shadow_bias<class_Light_property_shadow_bias>` gap.
|
|
|
|
----
|
|
|
|
.. _class_Light_property_shadow_enabled:
|
|
|
|
- :ref:`bool<class_bool>` **shadow_enabled**
|
|
|
|
+-----------+-------------------+
|
|
| *Default* | ``false`` |
|
|
+-----------+-------------------+
|
|
| *Setter* | set_shadow(value) |
|
|
+-----------+-------------------+
|
|
| *Getter* | has_shadow() |
|
|
+-----------+-------------------+
|
|
|
|
Si ``true``, la luz proyectará sombras.
|
|
|
|
----
|
|
|
|
.. _class_Light_property_shadow_reverse_cull_face:
|
|
|
|
- :ref:`bool<class_bool>` **shadow_reverse_cull_face**
|
|
|
|
+-----------+-------------------------------------+
|
|
| *Default* | ``false`` |
|
|
+-----------+-------------------------------------+
|
|
| *Setter* | set_shadow_reverse_cull_face(value) |
|
|
+-----------+-------------------------------------+
|
|
| *Getter* | get_shadow_reverse_cull_face() |
|
|
+-----------+-------------------------------------+
|
|
|
|
If ``true``, reverses the backface culling of the mesh. This can be useful when you have a flat mesh that has a light behind it. If you need to cast a shadow on both sides of the mesh, set the mesh to use double-sided shadows with :ref:`GeometryInstance.SHADOW_CASTING_SETTING_DOUBLE_SIDED<class_GeometryInstance_constant_SHADOW_CASTING_SETTING_DOUBLE_SIDED>`.
|
|
|
|
Descripciones de Métodos
|
|
------------------------------------------------
|
|
|
|
.. _class_Light_method_get_param:
|
|
|
|
- :ref:`float<class_float>` **get_param** **(** :ref:`Param<enum_Light_Param>` param **)** |const|
|
|
|
|
Returns the value of the specified :ref:`Param<enum_Light_Param>` parameter.
|
|
|
|
----
|
|
|
|
.. _class_Light_method_set_param:
|
|
|
|
- void **set_param** **(** :ref:`Param<enum_Light_Param>` param, :ref:`float<class_float>` value **)**
|
|
|
|
Sets the value of the specified :ref:`Param<enum_Light_Param>` parameter.
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
|
|
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
|
|
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
|