class_light.rst 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the Light.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_Light:
  5. Light
  6. =====
  7. **Inherits:** :ref:`VisualInstance<class_VisualInstance>` **<** :ref:`Spatial<class_Spatial>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  8. **Inherited By:** :ref:`DirectionalLight<class_DirectionalLight>`, :ref:`OmniLight<class_OmniLight>`, :ref:`SpotLight<class_SpotLight>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Provides a base class for different kinds of light nodes.
  13. Properties
  14. ----------
  15. +--------------------------------------+--------------------------------------------------------------------------------+
  16. | :ref:`bool<class_bool>` | :ref:`editor_only<class_Light_property_editor_only>` |
  17. +--------------------------------------+--------------------------------------------------------------------------------+
  18. | :ref:`BakeMode<enum_Light_BakeMode>` | :ref:`light_bake_mode<class_Light_property_light_bake_mode>` |
  19. +--------------------------------------+--------------------------------------------------------------------------------+
  20. | :ref:`Color<class_Color>` | :ref:`light_color<class_Light_property_light_color>` |
  21. +--------------------------------------+--------------------------------------------------------------------------------+
  22. | :ref:`int<class_int>` | :ref:`light_cull_mask<class_Light_property_light_cull_mask>` |
  23. +--------------------------------------+--------------------------------------------------------------------------------+
  24. | :ref:`float<class_float>` | :ref:`light_energy<class_Light_property_light_energy>` |
  25. +--------------------------------------+--------------------------------------------------------------------------------+
  26. | :ref:`float<class_float>` | :ref:`light_indirect_energy<class_Light_property_light_indirect_energy>` |
  27. +--------------------------------------+--------------------------------------------------------------------------------+
  28. | :ref:`bool<class_bool>` | :ref:`light_negative<class_Light_property_light_negative>` |
  29. +--------------------------------------+--------------------------------------------------------------------------------+
  30. | :ref:`float<class_float>` | :ref:`light_specular<class_Light_property_light_specular>` |
  31. +--------------------------------------+--------------------------------------------------------------------------------+
  32. | :ref:`float<class_float>` | :ref:`shadow_bias<class_Light_property_shadow_bias>` |
  33. +--------------------------------------+--------------------------------------------------------------------------------+
  34. | :ref:`Color<class_Color>` | :ref:`shadow_color<class_Light_property_shadow_color>` |
  35. +--------------------------------------+--------------------------------------------------------------------------------+
  36. | :ref:`float<class_float>` | :ref:`shadow_contact<class_Light_property_shadow_contact>` |
  37. +--------------------------------------+--------------------------------------------------------------------------------+
  38. | :ref:`bool<class_bool>` | :ref:`shadow_enabled<class_Light_property_shadow_enabled>` |
  39. +--------------------------------------+--------------------------------------------------------------------------------+
  40. | :ref:`bool<class_bool>` | :ref:`shadow_reverse_cull_face<class_Light_property_shadow_reverse_cull_face>` |
  41. +--------------------------------------+--------------------------------------------------------------------------------+
  42. Enumerations
  43. ------------
  44. .. _enum_Light_Param:
  45. .. _class_Light_constant_PARAM_ENERGY:
  46. .. _class_Light_constant_PARAM_INDIRECT_ENERGY:
  47. .. _class_Light_constant_PARAM_SPECULAR:
  48. .. _class_Light_constant_PARAM_RANGE:
  49. .. _class_Light_constant_PARAM_ATTENUATION:
  50. .. _class_Light_constant_PARAM_SPOT_ANGLE:
  51. .. _class_Light_constant_PARAM_SPOT_ATTENUATION:
  52. .. _class_Light_constant_PARAM_CONTACT_SHADOW_SIZE:
  53. .. _class_Light_constant_PARAM_SHADOW_MAX_DISTANCE:
  54. .. _class_Light_constant_PARAM_SHADOW_SPLIT_1_OFFSET:
  55. .. _class_Light_constant_PARAM_SHADOW_SPLIT_2_OFFSET:
  56. .. _class_Light_constant_PARAM_SHADOW_SPLIT_3_OFFSET:
  57. .. _class_Light_constant_PARAM_SHADOW_NORMAL_BIAS:
  58. .. _class_Light_constant_PARAM_SHADOW_BIAS:
  59. .. _class_Light_constant_PARAM_SHADOW_BIAS_SPLIT_SCALE:
  60. .. _class_Light_constant_PARAM_MAX:
  61. enum **Param**:
  62. - **PARAM_ENERGY** = **0**
  63. - **PARAM_INDIRECT_ENERGY** = **1**
  64. - **PARAM_SPECULAR** = **2**
  65. - **PARAM_RANGE** = **3**
  66. - **PARAM_ATTENUATION** = **4**
  67. - **PARAM_SPOT_ANGLE** = **5**
  68. - **PARAM_SPOT_ATTENUATION** = **6**
  69. - **PARAM_CONTACT_SHADOW_SIZE** = **7**
  70. - **PARAM_SHADOW_MAX_DISTANCE** = **8**
  71. - **PARAM_SHADOW_SPLIT_1_OFFSET** = **9**
  72. - **PARAM_SHADOW_SPLIT_2_OFFSET** = **10**
  73. - **PARAM_SHADOW_SPLIT_3_OFFSET** = **11**
  74. - **PARAM_SHADOW_NORMAL_BIAS** = **12**
  75. - **PARAM_SHADOW_BIAS** = **13**
  76. - **PARAM_SHADOW_BIAS_SPLIT_SCALE** = **14**
  77. - **PARAM_MAX** = **15**
  78. .. _enum_Light_BakeMode:
  79. .. _class_Light_constant_BAKE_DISABLED:
  80. .. _class_Light_constant_BAKE_INDIRECT:
  81. .. _class_Light_constant_BAKE_ALL:
  82. enum **BakeMode**:
  83. - **BAKE_DISABLED** = **0** --- Light is ignored when baking. Note: hiding a light does *not* affect baking.
  84. - **BAKE_INDIRECT** = **1** --- Only indirect lighting will be baked. Default value.
  85. - **BAKE_ALL** = **2** --- Both direct and indirect light will be baked. Note: you should hide the light if you don't want it to appear twice (dynamic and baked).
  86. Description
  87. -----------
  88. Light is the abstract base class for light nodes, so it shouldn't be used directly (It can't be instanced). Other types of light nodes inherit from it. Light contains the common variables and parameters used for lighting.
  89. Tutorials
  90. ---------
  91. - :doc:`../tutorials/3d/lights_and_shadows`
  92. Property Descriptions
  93. ---------------------
  94. .. _class_Light_property_editor_only:
  95. - :ref:`bool<class_bool>` **editor_only**
  96. +----------+------------------------+
  97. | *Setter* | set_editor_only(value) |
  98. +----------+------------------------+
  99. | *Getter* | is_editor_only() |
  100. +----------+------------------------+
  101. If ``true``, the light only appears in the editor and will not be visible at runtime. Default value:``false``.
  102. .. _class_Light_property_light_bake_mode:
  103. - :ref:`BakeMode<enum_Light_BakeMode>` **light_bake_mode**
  104. +----------+----------------------+
  105. | *Setter* | set_bake_mode(value) |
  106. +----------+----------------------+
  107. | *Getter* | get_bake_mode() |
  108. +----------+----------------------+
  109. The light's bake mode. See :ref:`BakeMode<enum_Light_BakeMode>`.
  110. .. _class_Light_property_light_color:
  111. - :ref:`Color<class_Color>` **light_color**
  112. +----------+------------------+
  113. | *Setter* | set_color(value) |
  114. +----------+------------------+
  115. | *Getter* | get_color() |
  116. +----------+------------------+
  117. The light's color.
  118. .. _class_Light_property_light_cull_mask:
  119. - :ref:`int<class_int>` **light_cull_mask**
  120. +----------+----------------------+
  121. | *Setter* | set_cull_mask(value) |
  122. +----------+----------------------+
  123. | *Getter* | get_cull_mask() |
  124. +----------+----------------------+
  125. The light will affect objects in the selected layers.
  126. .. _class_Light_property_light_energy:
  127. - :ref:`float<class_float>` **light_energy**
  128. +----------+------------------+
  129. | *Setter* | set_param(value) |
  130. +----------+------------------+
  131. | *Getter* | get_param() |
  132. +----------+------------------+
  133. The light's strength multiplier.
  134. .. _class_Light_property_light_indirect_energy:
  135. - :ref:`float<class_float>` **light_indirect_energy**
  136. +----------+------------------+
  137. | *Setter* | set_param(value) |
  138. +----------+------------------+
  139. | *Getter* | get_param() |
  140. +----------+------------------+
  141. Secondary multiplier used with indirect light (light bounces). This works in baked light or GIProbe.
  142. .. _class_Light_property_light_negative:
  143. - :ref:`bool<class_bool>` **light_negative**
  144. +----------+---------------------+
  145. | *Setter* | set_negative(value) |
  146. +----------+---------------------+
  147. | *Getter* | is_negative() |
  148. +----------+---------------------+
  149. If ``true``, the light's effect is reversed, darkening areas and casting bright shadows. Default value: ``false``.
  150. .. _class_Light_property_light_specular:
  151. - :ref:`float<class_float>` **light_specular**
  152. +----------+------------------+
  153. | *Setter* | set_param(value) |
  154. +----------+------------------+
  155. | *Getter* | get_param() |
  156. +----------+------------------+
  157. The intensity of the specular blob in objects affected by the light. At ``0`` the light becomes a pure diffuse light.
  158. .. _class_Light_property_shadow_bias:
  159. - :ref:`float<class_float>` **shadow_bias**
  160. +----------+------------------+
  161. | *Setter* | set_param(value) |
  162. +----------+------------------+
  163. | *Getter* | get_param() |
  164. +----------+------------------+
  165. Used to adjust shadow appearance. Too small a value results in self shadowing, while too large a value causes shadows to separate from casters. Adjust as needed.
  166. .. _class_Light_property_shadow_color:
  167. - :ref:`Color<class_Color>` **shadow_color**
  168. +----------+-------------------------+
  169. | *Setter* | set_shadow_color(value) |
  170. +----------+-------------------------+
  171. | *Getter* | get_shadow_color() |
  172. +----------+-------------------------+
  173. The color of shadows cast by this light.
  174. .. _class_Light_property_shadow_contact:
  175. - :ref:`float<class_float>` **shadow_contact**
  176. +----------+------------------+
  177. | *Setter* | set_param(value) |
  178. +----------+------------------+
  179. | *Getter* | get_param() |
  180. +----------+------------------+
  181. Attempts to reduce :ref:`shadow_bias<class_Light_property_shadow_bias>` gap.
  182. .. _class_Light_property_shadow_enabled:
  183. - :ref:`bool<class_bool>` **shadow_enabled**
  184. +----------+-------------------+
  185. | *Setter* | set_shadow(value) |
  186. +----------+-------------------+
  187. | *Getter* | has_shadow() |
  188. +----------+-------------------+
  189. If ``true``, the light will cast shadows. Default value: ``false``.
  190. .. _class_Light_property_shadow_reverse_cull_face:
  191. - :ref:`bool<class_bool>` **shadow_reverse_cull_face**
  192. +----------+-------------------------------------+
  193. | *Setter* | set_shadow_reverse_cull_face(value) |
  194. +----------+-------------------------------------+
  195. | *Getter* | get_shadow_reverse_cull_face() |
  196. +----------+-------------------------------------+